Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 102371. ------------------------------------------------------------ revno: 102371 committer: Glenn Morris branch nick: trunk timestamp: Fri 2010-11-12 19:48:16 -0800 message: Document count-words-region. * doc/emacs/basic.texi (Position Info): Add M-x count-words-region. * doc/lispintro/emacs-lisp-intro.texi: Rename the `count-words-region' example, since there is now a standard command of that name. * etc/NEWS: Mention it. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2010-11-11 08:41:30 +0000 +++ doc/emacs/ChangeLog 2010-11-13 03:48:16 +0000 @@ -1,3 +1,7 @@ +2010-11-13 Glenn Morris + + * basic.texi (Position Info): Add M-x count-words-region. + 2010-11-11 Glenn Morris * msdog.texi (ls in Lisp): Update for ls-lisp changes. === modified file 'doc/emacs/basic.texi' --- doc/emacs/basic.texi 2010-07-10 18:52:53 +0000 +++ doc/emacs/basic.texi 2010-11-13 03:48:16 +0000 @@ -537,6 +537,8 @@ Display the number of lines in the current region. Normally bound to @kbd{M-=}, except in a few specialist modes. @xref{Mark}, for information about the region. +@item M-x count-words-region +Display the number of words in the current region. @item C-x = Display the character code of character after point, character position of point, and column of point (@code{what-cursor-position}). @@ -743,6 +745,3 @@ z z z}. The first @kbd{C-x z} repeats the command once, and each subsequent @kbd{z} repeats it once again. -@ignore - arch-tag: cda8952a-c439-41c1-aecf-4bc0d6482956 -@end ignore === modified file 'doc/lispintro/ChangeLog' --- doc/lispintro/ChangeLog 2010-10-11 01:57:48 +0000 +++ doc/lispintro/ChangeLog 2010-11-13 03:48:16 +0000 @@ -1,3 +1,8 @@ +2010-11-13 Glenn Morris + + * emacs-lisp-intro.texi: Rename the `count-words-region' example, + since there is now a standard command of that name. + 2010-10-11 Glenn Morris * Makefile.in (.dvi.ps): Remove unnecessary suffix rule. === modified file 'doc/lispintro/emacs-lisp-intro.texi' --- doc/lispintro/emacs-lisp-intro.texi 2010-06-23 02:51:01 +0000 +++ doc/lispintro/emacs-lisp-intro.texi 2010-11-13 03:48:16 +0000 @@ -704,23 +704,25 @@ * fwd-para while:: The forward motion @code{while} loop. Counting: Repetition and Regexps +@set COUNT-WORDS count-words-example +@c Length of variable name chosen so that things still line up when expanded. * Why Count Words:: -* count-words-region:: Use a regexp, but find a problem. +* @value{COUNT-WORDS}:: Use a regexp, but find a problem. * recursive-count-words:: Start with case of no words in region. * Counting Exercise:: -The @code{count-words-region} Function +The @code{@value{COUNT-WORDS}} Function -* Design count-words-region:: The definition using a @code{while} loop. -* Whitespace Bug:: The Whitespace Bug in @code{count-words-region}. +* Design @value{COUNT-WORDS}:: The definition using a @code{while} loop. +* Whitespace Bug:: The Whitespace Bug in @code{@value{COUNT-WORDS}}. Counting Words in a @code{defun} * Divide and Conquer:: * Words and Symbols:: What to count? * Syntax:: What constitutes a word or symbol? -* count-words-in-defun:: Very like @code{count-words}. +* count-words-in-defun:: Very like @code{@value{COUNT-WORDS}}. * Several defuns:: Counting several defuns in a file. * Find a File:: Do you want to look at a file? * lengths-list-file:: A list of the lengths of many definitions. @@ -13829,35 +13831,37 @@ @menu * Why Count Words:: -* count-words-region:: Use a regexp, but find a problem. +* @value{COUNT-WORDS}:: Use a regexp, but find a problem. * recursive-count-words:: Start with case of no words in region. * Counting Exercise:: @end menu -@node Why Count Words, count-words-region, Counting Words, Counting Words +@node Why Count Words, @value{COUNT-WORDS}, Counting Words, Counting Words @ifnottex @unnumberedsec Counting words @end ifnottex -The standard Emacs distribution contains a function for counting the -number of lines within a region. However, there is no corresponding -function for counting words. +The standard Emacs distribution contains functions for counting the +number of lines and words within a region. Certain types of writing ask you to count words. Thus, if you write an essay, you may be limited to 800 words; if you write a novel, you -may discipline yourself to write 1000 words a day. It seems odd to me -that Emacs lacks a word count command. Perhaps people use Emacs -mostly for code or types of documentation that do not require word -counts; or perhaps they restrict themselves to the operating system -word count command, @code{wc}. Alternatively, people may follow -the publishers' convention and compute a word count by dividing the -number of characters in a document by five. In any event, here are -commands to count words. - -@node count-words-region, recursive-count-words, Why Count Words, Counting Words +may discipline yourself to write 1000 words a day. It seems odd, but +for a long time, Emacs lacked a word count command. Perhaps people used +Emacs mostly for code or types of documentation that did not require +word counts; or perhaps they restricted themselves to the operating +system word count command, @code{wc}. Alternatively, people may have +followed the publishers' convention and computed a word count by +dividing the number of characters in a document by five. + +There are many ways to implement a command to count words. Here are +some examples, which you may wish to compare with the standard Emacs +command, @code{count-words-region}. + +@node @value{COUNT-WORDS}, recursive-count-words, Why Count Words, Counting Words @comment node-name, next, previous, up -@section The @code{count-words-region} Function -@findex count-words-region +@section The @code{@value{COUNT-WORDS}} Function +@findex @value{COUNT-WORDS} A word count command could count words in a line, paragraph, region, or buffer. What should the command cover? You could design the @@ -13865,7 +13869,7 @@ the Emacs tradition encourages flexibility---you may want to count words in just a section, rather than all of a buffer. So it makes more sense to design the command to count the number of words in a -region. Once you have a @code{count-words-region} command, you can, +region. Once you have a command to count words in a region, you can, if you wish, count words in a whole buffer by marking it with @w{@kbd{C-x h}} (@code{mark-whole-buffer}). @@ -13876,13 +13880,13 @@ or to a @code{while} loop. @menu -* Design count-words-region:: The definition using a @code{while} loop. -* Whitespace Bug:: The Whitespace Bug in @code{count-words-region}. +* Design @value{COUNT-WORDS}:: The definition using a @code{while} loop. +* Whitespace Bug:: The Whitespace Bug in @code{@value{COUNT-WORDS}}. @end menu -@node Design count-words-region, Whitespace Bug, count-words-region, count-words-region +@node Design @value{COUNT-WORDS}, Whitespace Bug, @value{COUNT-WORDS}, @value{COUNT-WORDS} @ifnottex -@unnumberedsubsec Designing @code{count-words-region} +@unnumberedsubsec Designing @code{@value{COUNT-WORDS}} @end ifnottex First, we will implement the word count command with a @code{while} @@ -13905,7 +13909,9 @@ The name of the function should be self-explanatory and similar to the existing @code{count-lines-region} name. This makes the name easier -to remember. @code{count-words-region} is a good choice. +to remember. @code{count-words-region} is the obvious choice. Since +that name is now used for the standard Emacs command to count words, we +will name our implementation @code{@value{COUNT-WORDS}}. The function counts words within a region. This means that the argument list must contain symbols that are bound to the two @@ -13923,7 +13929,7 @@ count words, second, to run the @code{while} loop, and third, to send a message to the user. -When a user calls @code{count-words-region}, point may be at the +When a user calls @code{@value{COUNT-WORDS}}, point may be at the beginning or the end of the region. However, the counting process must start at the beginning of the region. This means we will want to put point there if it is not already there. Executing @@ -14015,7 +14021,7 @@ @smallexample @group ;;; @r{First version; has bugs!} -(defun count-words-region (beginning end) +(defun @value{COUNT-WORDS} (beginning end) "Print number of words in the region. Words are defined as at least one word-constituent character followed by at least one character that @@ -14056,14 +14062,14 @@ @noindent As written, the function works, but not in all circumstances. -@node Whitespace Bug, , Design count-words-region, count-words-region +@node Whitespace Bug, , Design @value{COUNT-WORDS}, @value{COUNT-WORDS} @comment node-name, next, previous, up -@subsection The Whitespace Bug in @code{count-words-region} +@subsection The Whitespace Bug in @code{@value{COUNT-WORDS}} -The @code{count-words-region} command described in the preceding +The @code{@value{COUNT-WORDS}} command described in the preceding section has two bugs, or rather, one bug with two manifestations. First, if you mark a region containing only whitespace in the middle -of some text, the @code{count-words-region} command tells you that the +of some text, the @code{@value{COUNT-WORDS}} command tells you that the region contains one word! Second, if you mark a region containing only whitespace at the end of the buffer or the accessible portion of a narrowed buffer, the command displays an error message that looks @@ -14084,7 +14090,7 @@ @smallexample @group ;; @r{First version; has bugs!} -(defun count-words-region (beginning end) +(defun @value{COUNT-WORDS} (beginning end) "Print number of words in the region. Words are defined as at least one word-constituent character followed by at least one character that is not a word-constituent. The buffer's @@ -14123,12 +14129,12 @@ If you wish, you can also install this keybinding by evaluating it: @smallexample -(global-set-key "\C-c=" 'count-words-region) +(global-set-key "\C-c=" '@value{COUNT-WORDS}) @end smallexample To conduct the first test, set mark and point to the beginning and end of the following line and then type @kbd{C-c =} (or @kbd{M-x -count-words-region} if you have not bound @kbd{C-c =}): +@value{COUNT-WORDS}} if you have not bound @kbd{C-c =}): @smallexample one two three @@ -14139,7 +14145,7 @@ Repeat the test, but place mark at the beginning of the line and place point just @emph{before} the word @samp{one}. Again type the command -@kbd{C-c =} (or @kbd{M-x count-words-region}). Emacs should tell you +@kbd{C-c =} (or @kbd{M-x @value{COUNT-WORDS}}). Emacs should tell you that the region has no words, since it is composed only of the whitespace at the beginning of the line. But instead Emacs tells you that the region has one word! @@ -14148,7 +14154,7 @@ @file{*scratch*} buffer and then type several spaces at the end of the line. Place mark right after the word @samp{three} and point at the end of line. (The end of the line will be the end of the buffer.) -Type @kbd{C-c =} (or @kbd{M-x count-words-region}) as you did before. +Type @kbd{C-c =} (or @kbd{M-x @value{COUNT-WORDS}}) as you did before. Again, Emacs should tell you that the region has no words, since it is composed only of the whitespace at the end of the line. Instead, Emacs displays an error message saying @samp{Search failed}. @@ -14157,7 +14163,7 @@ Consider the first manifestation of the bug, in which the command tells you that the whitespace at the beginning of the line contains -one word. What happens is this: The @code{M-x count-words-region} +one word. What happens is this: The @code{M-x @value{COUNT-WORDS}} command moves point to the beginning of the region. The @code{while} tests whether the value of point is smaller than the value of @code{end}, which it is. Consequently, the regular expression search @@ -14191,7 +14197,7 @@ repeat count. (In Emacs, you can see a function's documentation by typing @kbd{C-h f}, the name of the function, and then @key{RET}.) -In the @code{count-words-region} definition, the value of the end of +In the @code{@value{COUNT-WORDS}} definition, the value of the end of the region is held by the variable @code{end} which is passed as an argument to the function. Thus, we can add @code{end} as an argument to the regular expression search expression: @@ -14200,7 +14206,7 @@ (re-search-forward "\\w+\\W*" end) @end smallexample -However, if you make only this change to the @code{count-words-region} +However, if you make only this change to the @code{@value{COUNT-WORDS}} definition and then test the new version of the definition on a stretch of whitespace, you will receive an error message saying @samp{Search failed}. @@ -14231,7 +14237,7 @@ than the value of end, since the @code{re-search-forward} expression did not move point. @dots{} and the cycle repeats @dots{} -The @code{count-words-region} definition requires yet another +The @code{@value{COUNT-WORDS}} definition requires yet another modification, to cause the true-or-false-test of the @code{while} loop to test false if the search fails. Put another way, there are two conditions that must be satisfied in the true-or-false-test before the @@ -14265,17 +14271,17 @@ found, point is moved through the region. When the search expression fails to find another word, or when point reaches the end of the region, the true-or-false-test tests false, the @code{while} loop -exits, and the @code{count-words-region} function displays one or +exits, and the @code{@value{COUNT-WORDS}} function displays one or other of its messages. -After incorporating these final changes, the @code{count-words-region} +After incorporating these final changes, the @code{@value{COUNT-WORDS}} works without bugs (or at least, without bugs that I have found!). Here is what it looks like: @smallexample @group ;;; @r{Final version:} @code{while} -(defun count-words-region (beginning end) +(defun @value{COUNT-WORDS} (beginning end) "Print number of words in the region." (interactive "r") (message "Counting words in region ... ") @@ -14309,7 +14315,7 @@ @end group @end smallexample -@node recursive-count-words, Counting Exercise, count-words-region, Counting Words +@node recursive-count-words, Counting Exercise, @value{COUNT-WORDS}, Counting Words @comment node-name, next, previous, up @section Count Words Recursively @cindex Count words recursively @@ -14319,7 +14325,7 @@ You can write the function for counting words recursively as well as with a @code{while} loop. Let's see how this is done. -First, we need to recognize that the @code{count-words-region} +First, we need to recognize that the @code{@value{COUNT-WORDS}} function has three jobs: it sets up the appropriate conditions for counting to occur; it counts the words in the region; and it sends a message to the user telling how many words there are. @@ -14333,7 +14339,7 @@ message; the other will return the word count. Let us start with the function that causes the message to be displayed. -We can continue to call this @code{count-words-region}. +We can continue to call this @code{@value{COUNT-WORDS}}. This is the function that the user will call. It will be interactive. Indeed, it will be similar to our previous versions of this @@ -14347,7 +14353,7 @@ @smallexample @group ;; @r{Recursive version; uses regular expression search} -(defun count-words-region (beginning end) +(defun @value{COUNT-WORDS} (beginning end) "@var{documentation}@dots{}" (@var{interactive-expression}@dots{}) @end group @@ -14388,7 +14394,7 @@ @smallexample @group -(defun count-words-region (beginning end) +(defun @value{COUNT-WORDS} (beginning end) "Print number of words in the region." (interactive "r") @end group @@ -14484,7 +14490,7 @@ Note that the search expression is part of the do-again-test---the function returns @code{t} if its search succeeds and @code{nil} if it fails. (@xref{Whitespace Bug, , The Whitespace Bug in -@code{count-words-region}}, for an explanation of how +@code{@value{COUNT-WORDS}}}, for an explanation of how @code{re-search-forward} works.) The do-again-test is the true-or-false test of an @code{if} clause. @@ -14657,7 +14663,7 @@ @smallexample @group ;;; @r{Recursive version} -(defun count-words-region (beginning end) +(defun @value{COUNT-WORDS} (beginning end) "Print number of words in the region. @end group @@ -14702,11 +14708,11 @@ Our next project is to count the number of words in a function definition. Clearly, this can be done using some variant of -@code{count-word-region}. @xref{Counting Words, , Counting Words: +@code{@value{COUNT-WORDS}}. @xref{Counting Words, , Counting Words: Repetition and Regexps}. If we are just going to count the words in one definition, it is easy enough to mark the definition with the @kbd{C-M-h} (@code{mark-defun}) command, and then call -@code{count-word-region}. +@code{@value{COUNT-WORDS}}. However, I am more ambitious: I want to count the words and symbols in every definition in the Emacs sources and then print a graph that @@ -14719,7 +14725,7 @@ * Divide and Conquer:: * Words and Symbols:: What to count? * Syntax:: What constitutes a word or symbol? -* count-words-in-defun:: Very like @code{count-words}. +* count-words-in-defun:: Very like @code{@value{COUNT-WORDS}}. * Several defuns:: Counting several defuns in a file. * Find a File:: Do you want to look at a file? * lengths-list-file:: A list of the lengths of many definitions. @@ -14793,11 +14799,11 @@ @noindent However, if we mark the @code{multiply-by-seven} definition with @kbd{C-M-h} (@code{mark-defun}), and then call -@code{count-words-region} on it, we will find that -@code{count-words-region} claims the definition has eleven words, not +@code{@value{COUNT-WORDS}} on it, we will find that +@code{@value{COUNT-WORDS}} claims the definition has eleven words, not ten! Something is wrong! -The problem is twofold: @code{count-words-region} does not count the +The problem is twofold: @code{@value{COUNT-WORDS}} does not count the @samp{*} as a word, and it counts the single symbol, @code{multiply-by-seven}, as containing three words. The hyphens are treated as if they were interword spaces rather than intraword @@ -14805,8 +14811,8 @@ @samp{multiply by seven}. The cause of this confusion is the regular expression search within -the @code{count-words-region} definition that moves point forward word -by word. In the canonical version of @code{count-words-region}, the +the @code{@value{COUNT-WORDS}} definition that moves point forward word +by word. In the canonical version of @code{@value{COUNT-WORDS}}, the regexp is: @smallexample @@ -14839,8 +14845,8 @@ Usually, a hyphen is not specified as a `word constituent character'. Instead, it is specified as being in the `class of characters that are part of symbol names but not words.' This means that the -@code{count-words-region} function treats it in the same way it treats -an interword white space, which is why @code{count-words-region} +@code{@value{COUNT-WORDS}} function treats it in the same way it treats +an interword white space, which is why @code{@value{COUNT-WORDS}} counts @samp{multiply-by-seven} as three words. There are two ways to cause Emacs to count @samp{multiply-by-seven} as @@ -14853,7 +14859,7 @@ constituent character; there are others, too. Alternatively, we can redefine the regular expression used in the -@code{count-words} definition so as to include symbols. This +@code{@value{COUNT-WORDS}} definition so as to include symbols. This procedure has the merit of clarity, but the task is a little tricky. @need 1200 @@ -14910,7 +14916,7 @@ @cindex Counting words in a @code{defun} We have seen that there are several ways to write a -@code{count-word-region} function. To write a +@code{count-words-region} function. To write a @code{count-words-in-defun}, we need merely adapt one of these versions. @@ -15044,7 +15050,7 @@ How to test this? The function is not interactive, but it is easy to put a wrapper around the function to make it interactive; we can use almost the same code as for the recursive version of -@code{count-words-region}: +@code{@value{COUNT-WORDS}}: @smallexample @group @@ -18885,7 +18891,7 @@ @itemize @bullet @item -Install the @code{count-words-region} function and then cause it to +Install the @code{@value{COUNT-WORDS}} function and then cause it to enter the built-in debugger when you call it. Run the command on a region containing two words. You will need to press @kbd{d} a remarkable number of times. On your system, is a `hook' called after @@ -18894,7 +18900,7 @@ Manual}.) @item -Copy @code{count-words-region} into the @file{*scratch*} buffer, +Copy @code{@value{COUNT-WORDS}} into the @file{*scratch*} buffer, instrument the function for Edebug, and walk through its execution. The function does not need to have a bug, although you can introduce one if you wish. If the function lacks a bug, the walk-through @@ -18909,7 +18915,7 @@ @item In the Edebug debugging buffer, use the @kbd{p} (@code{edebug-bounce-point}) command to see where in the region the -@code{count-words-region} is working. +@code{@value{COUNT-WORDS}} is working. @item Move point to some spot further down the function and then type the @@ -22272,6 +22278,3 @@ @bye -@ignore - arch-tag: da1a2154-531f-43a8-8e33-fc7faad10acf -@end ignore === modified file 'etc/NEWS' --- etc/NEWS 2010-11-12 14:13:48 +0000 +++ etc/NEWS 2010-11-13 03:48:16 +0000 @@ -213,6 +213,9 @@ * Editing Changes in Emacs 24.1 ++++ +** There is a new command `count-words-region', which does what you expect. + ** completion-at-point is now an alias for complete-symbol. ** Deletion changes ------------------------------------------------------------ revno: 102370 author: Hrvoje Niksic committer: Glenn Morris branch nick: trunk timestamp: Fri 2010-11-12 19:46:00 -0800 message: * lisp/simple.el (count-words-region): New function. From: http://lists.gnu.org/archive/html/emacs-devel/2006-09/msg01029.html diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-13 03:36:32 +0000 +++ lisp/ChangeLog 2010-11-13 03:46:00 +0000 @@ -1,3 +1,7 @@ +2010-11-13 Hrvoje Niksic + + * simple.el (count-words-region): New function. + 2010-11-12 Stefan Monnier * shell.el (shell-dir-cookie-re): New custom variable. === modified file 'lisp/simple.el' --- lisp/simple.el 2010-11-12 13:32:02 +0000 +++ lisp/simple.el 2010-11-13 03:46:00 +0000 @@ -973,6 +973,21 @@ (re-search-forward "[\n\C-m]" nil 'end (1- line)) (forward-line (1- line))))) +(defun count-words-region (start end) + "Print the number of words in the region. +When called interactively, the word count is printed in echo area." + (interactive "r") + (let ((count 0)) + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (forward-word 1) + (setq count (1+ count))))) + (if (interactive-p) + (message "Region has %d words" count)) + count)) + (defun count-lines-region (start end) "Print number of lines and characters in the region." (interactive "r") ------------------------------------------------------------ revno: 102369 committer: Glenn Morris branch nick: trunk timestamp: Fri 2010-11-12 19:36:32 -0800 message: ChangeLog whitespace. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 14:13:48 +0000 +++ lisp/ChangeLog 2010-11-13 03:36:32 +0000 @@ -89,7 +89,7 @@ * emacs-lisp/package.el (package-read-all-archive-contents): Reset package-archive-contents to nil before re-reading. -2010-11-10 Brandon Craig Rhodes (tiny change) +2010-11-10 Brandon Craig Rhodes (tiny change) * textmodes/flyspell.el (flyspell-word): Do not re-check words already found as misspellings by (flyspell-large-region), just ------------------------------------------------------------ revno: 102368 committer: Glenn Morris branch nick: trunk timestamp: Fri 2010-11-12 19:34:36 -0800 message: Standardize some file headers. diff: === modified file 'lisp/org/ob-R.el' --- lisp/org/ob-R.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-R.el 2010-11-13 03:34:36 +0000 @@ -2,7 +2,8 @@ ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research, R, statistics ;; Homepage: http://orgmode.org ;; Version: 7.3 === modified file 'lisp/org/ob-calc.el' --- lisp/org/ob-calc.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-calc.el 2010-11-13 03:34:36 +0000 @@ -1,6 +1,6 @@ ;;; ob-calc.el --- org-babel functions for calc code evaluation -;; Copyright (C) 2010 Free Software Foundation, Inc +;; Copyright (C) 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research === modified file 'lisp/org/ob-emacs-lisp.el' --- lisp/org/ob-emacs-lisp.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-emacs-lisp.el 2010-11-13 03:34:36 +0000 @@ -1,6 +1,6 @@ ;;; ob-emacs-lisp.el --- org-babel functions for emacs-lisp code evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research === modified file 'lisp/org/ob-js.el' --- lisp/org/ob-js.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-js.el 2010-11-13 03:34:36 +0000 @@ -1,28 +1,26 @@ ;;; ob-js.el --- org-babel functions for Javascript -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, js ;; Homepage: http://orgmode.org ;; Version: 7.3 -;;; License: +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. -;; + ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -35,7 +33,7 @@ ;; - a non-browser javascript engine such as node.js http://nodejs.org/ ;; or mozrepl http://wiki.github.com/bard/mozrepl/ -;; +;; ;; - for session based evaluation mozrepl and moz.el are required see ;; http://wiki.github.com/bard/mozrepl/emacs-integration for ;; configuration instructions === modified file 'lisp/org/ob-lisp.el' --- lisp/org/ob-lisp.el 2010-11-12 04:36:34 +0000 +++ lisp/org/ob-lisp.el 2010-11-13 03:34:36 +0000 @@ -1,28 +1,27 @@ ;;; ob-lisp.el --- org-babel functions for Common Lisp -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010 Free Software Foundation, Inc. -;; Author: David T. O'Toole , Eric Schulte +;; Author: David T. O'Toole +;; Eric Schulte ;; Keywords: literate programming, reproducible research, lisp ;; Homepage: http://orgmode.org ;; Version: 7.3 -;;; License: +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. -;; + ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: === modified file 'lisp/org/ob-lob.el' --- lisp/org/ob-lob.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-lob.el 2010-11-13 03:34:36 +0000 @@ -2,7 +2,8 @@ ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 7.3 @@ -25,7 +26,7 @@ ;;; Commentary: ;; See the online documentation for more information -;; +;; ;; http://orgmode.org/worg/org-contrib/babel/ ;;; Code: @@ -92,13 +93,13 @@ (beginning-of-line 1) (if (looking-at org-babel-lob-one-liner-regexp) (append - (mapcar #'org-babel-clean-text-properties + (mapcar #'org-babel-clean-text-properties (list (format "%s(%s)%s" (match-string 2) (match-string 3) (match-string 4)) (match-string 5))) (list (length (match-string 1)))))))) - + (defun org-babel-lob-execute (info) "Execute the lob call specified by INFO." (let ((params (org-babel-process-params === modified file 'lisp/org/ob-perl.el' --- lisp/org/ob-perl.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-perl.el 2010-11-13 03:34:36 +0000 @@ -1,8 +1,9 @@ ;;; ob-perl.el --- org-babel functions for perl evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Dan Davison, Eric Schulte +;; Author: Dan Davison +;; Eric Schulte ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 7.3 === modified file 'lisp/org/ob-python.el' --- lisp/org/ob-python.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-python.el 2010-11-13 03:34:36 +0000 @@ -1,8 +1,9 @@ ;;; ob-python.el --- org-babel functions for python evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 7.3 === modified file 'lisp/org/ob-ref.el' --- lisp/org/ob-ref.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-ref.el 2010-11-13 03:34:36 +0000 @@ -2,7 +2,8 @@ ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 7.3 === modified file 'lisp/org/ob-ruby.el' --- lisp/org/ob-ruby.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-ruby.el 2010-11-13 03:34:36 +0000 @@ -1,6 +1,6 @@ ;;; ob-ruby.el --- org-babel functions for ruby evaluation -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research @@ -29,10 +29,10 @@ ;;; Requirements: ;; - ruby and irb executables :: http://www.ruby-lang.org/ -;; +;; ;; - ruby-mode :: Can be installed through ELPA, or from ;; http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el -;; +;; ;; - inf-ruby mode :: Can be installed through ELPA, or from ;; http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el === modified file 'lisp/org/ob-scheme.el' --- lisp/org/ob-scheme.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-scheme.el 2010-11-13 03:34:36 +0000 @@ -1,28 +1,26 @@ ;;; ob-scheme.el --- org-babel functions for Scheme -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research, scheme ;; Homepage: http://orgmode.org ;; Version: 7.3 -;;; License: +;; This file is part of GNU Emacs. -;; This program is free software; you can redistribute it and/or modify +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. -;; + ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. +;; along with GNU Emacs. If not, see . ;;; Commentary: @@ -35,7 +33,7 @@ ;; - a working scheme implementation ;; (e.g. guile http://www.gnu.org/software/guile/guile.html) -;; +;; ;; - for session based evaluation cmuscheme.el is required which is ;; included in Emacs === modified file 'lisp/org/ob-screen.el' --- lisp/org/ob-screen.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-screen.el 2010-11-13 03:34:36 +0000 @@ -1,6 +1,6 @@ ;;; ob-screen.el --- org-babel support for interactive terminal -;; Copyright (C) 2009, 2010 Free Software Foundation +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. ;; Author: Benjamin Andresen ;; Keywords: literate programming, interactive shell === modified file 'lisp/org/ob-sqlite.el' --- lisp/org/ob-sqlite.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob-sqlite.el 2010-11-13 03:34:36 +0000 @@ -1,6 +1,6 @@ ;;; ob-sqlite.el --- org-babel functions for sqlite database interaction -;; Copyright (C) 2010 Free Software Foundation +;; Copyright (C) 2010 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Keywords: literate programming, reproducible research === modified file 'lisp/org/ob.el' --- lisp/org/ob.el 2010-11-12 04:10:19 +0000 +++ lisp/org/ob.el 2010-11-13 03:34:36 +0000 @@ -2,7 +2,8 @@ ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. -;; Author: Eric Schulte, Dan Davison +;; Author: Eric Schulte +;; Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org ;; Version: 7.3 === modified file 'lisp/org/org-mouse.el' --- lisp/org/org-mouse.el 2010-11-12 04:10:19 +0000 +++ lisp/org/org-mouse.el 2010-11-13 03:34:36 +0000 @@ -1,6 +1,7 @@ ;;; org-mouse.el --- Better mouse support for org-mode -;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation +;; Copyright (C) 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik ------------------------------------------------------------ revno: 102367 committer: Glenn Morris branch nick: trunk timestamp: Fri 2010-11-12 19:33:24 -0800 message: ChangeLog fixes. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2010-11-12 05:59:53 +0000 +++ doc/misc/ChangeLog 2010-11-13 03:33:24 +0000 @@ -4,7 +4,7 @@ 2010-11-11 Noorul Islam - * org.texi: Fix typo + * org.texi: Fix typo. 2010-11-11 Carsten Dominik @@ -13,8 +13,7 @@ 2010-11-11 Carsten Dominik - * org.texi (Images and tables): Add cross reference to - link section. + * org.texi (Images and tables): Add cross reference to link section. 2010-11-11 Carsten Dominik @@ -22,18 +21,16 @@ 2010-11-11 Eric Schulte - * multi-line header arguments :PROPERTIES: :ID: - b77c8857-6c76-4ea9-8a61-ddc2648d96c4 :END: - -2010-11-11 Carsten Dominik - - * org.texi (CSS support): Document :HTML_CONTAINER_CLASS: - property - -2010-11-11 Carsten Dominik - - * org.texi (Project alist): Mention that this is a - property list + * org.texi: multi-line header arguments :PROPERTIES: :ID: + b77c8857-6c76-4ea9-8a61-ddc2648d96c4 :END:. + +2010-11-11 Carsten Dominik + + * org.texi (CSS support): Document :HTML_CONTAINER_CLASS: property. + +2010-11-11 Carsten Dominik + + * org.texi (Project alist): Mention that this is a property list. 2010-11-11 Carsten Dominik @@ -47,18 +44,13 @@ 2010-11-11 Eric Schulte - * org.texi (noweb): updating :noweb documentation to - reflect the new "tangle" argument - -2010-11-11 Sebastian Rose, Hannover, Germany - - * org-test-which-func: New function. Find name of defun - around point. + * org.texi (noweb): Update :noweb documentation to + reflect the new "tangle" argument. 2010-11-11 Eric Schulte - * org.texi (Batch execution): improved tangling script in - documentation + * org.texi (Batch execution): Improve tangling script in + documentation. 2010-11-11 Carsten Dominik @@ -72,42 +64,37 @@ 2010-11-11 David Maus - * org.texi (Template expansion): Add date related link - type escapes - -2010-11-11 David Maus - - * org.texi (Template expansion): Add mew in table for - link type escapes. - -2010-11-11 David Maus - - * org.texi (Template expansion): Fix typo in link type + * org.texi (Template expansion): Add date related link type escapes. + +2010-11-11 David Maus + + * org.texi (Template expansion): Add mew in table for link type escapes. -2010-11-11 Eric Schulte - - * org.texi (Structure of code blocks): another - documentation tweak - -2010-11-11 Eric Schulte - - * org.texi (Structure of code blocks): documentation - tweak - -2010-11-11 Eric Schulte - - * org.texi (Structure of code blocks): updating - documentation to mention inline code block syntax - -2010-11-11 Eric Schulte - - * org.texi (comments): improved wording - -2010-11-11 Eric Schulte - - * org.texi (comments): documenting the new :comments - header arguments +2010-11-11 David Maus + + * org.texi (Template expansion): Fix typo in link type escapes. + +2010-11-11 Eric Schulte + + * org.texi (Structure of code blocks): Another documentation tweak. + +2010-11-11 Eric Schulte + + * org.texi (Structure of code blocks): Documentation tweak. + +2010-11-11 Eric Schulte + + * org.texi (Structure of code blocks): + Update documentation to mention inline code block syntax. + +2010-11-11 Eric Schulte + + * org.texi (comments): Improve wording. + +2010-11-11 Eric Schulte + + * org.texi (comments): Document the new :comments header arguments. 2010-11-11 Carsten Dominik @@ -116,12 +103,12 @@ 2010-11-11 Jambunathan K (tiny change) - * org.texi (Easy Templates): New section. Documents quick + * org.texi (Easy Templates): New section. Documents quick insertion of empty structural elements. 2010-11-11 Noorul Islam - * org.texi: Fix doc + * org.texi: Fix doc. 2010-11-11 Jambunathan K (tiny change) === modified file 'etc/ChangeLog' --- etc/ChangeLog 2010-11-12 04:10:19 +0000 +++ etc/ChangeLog 2010-11-13 03:33:24 +0000 @@ -1,7 +1,6 @@ 2010-11-11 Eric Schulte - * refcards/orgcard.tex: adding new Babel key sequences to the - org refcard + * refcards/orgcard.tex: Add new Babel key sequences. 2010-10-26 Glenn Morris @@ -5109,12 +5108,11 @@ ;; Local Variables: ;; coding: utf-8 -;; add-log-time-zone-rule: t ;; End: - Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001 - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -5130,5 +5128,3 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . - -;;; arch-tag: 094f3a51-bd72-44d0-8fac-2ac242c6c5b1 ------------------------------------------------------------ revno: 102366 committer: Carsten Dominik branch nick: trunk timestamp: Fri 2010-11-12 16:34:06 -0600 message: Remove autoload for org-capture-templates diff: === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2010-11-12 04:36:34 +0000 +++ lisp/org/ChangeLog 2010-11-12 22:34:06 +0000 @@ -1,5 +1,8 @@ 2010-11-12 Carsten Dominik + * org-capture.el (org-capture-templates): Remove autoload from + defcustom. + * ob-lisp.el (slime): Don't expect slime to be present. 2010-11-11 Dan Davison === modified file 'lisp/org/org-capture.el' --- lisp/org/org-capture.el 2010-11-12 04:10:19 +0000 +++ lisp/org/org-capture.el 2010-11-12 22:34:06 +0000 @@ -76,7 +76,6 @@ :tag "Org Capture" :group 'org) -;;;###autoload (defcustom org-capture-templates nil "Templates for the creation of new entries. ------------------------------------------------------------ revno: 102365 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2010-11-12 09:13:48 -0500 message: * lisp/shell.el (shell-dir-cookie-re): New custom variable. (shell-dir-cookie-watcher): New function. diff: === modified file 'etc/NEWS' --- etc/NEWS 2010-11-11 21:06:15 +0000 +++ etc/NEWS 2010-11-12 14:13:48 +0000 @@ -289,6 +289,9 @@ * Changes in Specialized Modes and Packages in Emacs 24.1 +** shell-mode can track your cwd by reading it from your prompt. +Just set shell-dir-cookie-re to an appropriate regexp. + ** Modula-2 mode provides auto-indentation. ** latex-electric-env-pair-mode keeps \begin..\end matched on the fly. @@ -529,8 +532,6 @@ ** pcase.el provides the ML-style pattern matching macro `pcase'. -** smie.el is a package providing a simple generic indentation engine. - ** secrets.el is an implementation of the Secret Service API, an interface to password managers like GNOME Keyring or KDE Wallet. The Secret Service API requires D-Bus for communication. The command === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 13:44:46 +0000 +++ lisp/ChangeLog 2010-11-12 14:13:48 +0000 @@ -1,5 +1,8 @@ 2010-11-12 Stefan Monnier + * shell.el (shell-dir-cookie-re): New custom variable. + (shell-dir-cookie-watcher): New function. + * vc/vc.el (vc-deduce-backend): Use default-directory in shell-mode and compilation-mode (bug#7350). === modified file 'lisp/shell.el' --- lisp/shell.el 2010-11-06 20:23:42 +0000 +++ lisp/shell.el 2010-11-12 14:13:48 +0000 @@ -472,6 +472,10 @@ (when (string-equal shell "bash") (add-hook 'comint-output-filter-functions 'shell-filter-ctrl-a-ctrl-b nil t))) + (when shell-dir-cookie-re + ;; Watch for magic cookies in the output to track the current dir. + (add-hook 'comint-output-filter-functions + 'shell-dir-cookie-watcher nil t)) (comint-read-input-ring t))) (defun shell-filter-ctrl-a-ctrl-b (string) @@ -619,6 +623,31 @@ ;; replace it with a process filter that watches for and strips out ;; these messages. +(defcustom shell-dir-cookie-re nil + "Regexp matching your prompt, including some part of the current directory. +If your prompt includes the current directory or the last few elements of it, +set this to a pattern that matches your prompt and whose subgroup 1 matches +the directory part of it. +This is used by `shell-dir-cookie-watcher' to try and use this info +to track your current directory. It can be used instead of or in addition +to `dirtrack-mode'." + :type '(choice (const nil) regexp)) + +(defun shell-dir-cookie-watcher (text) + ;; This is fragile: the TEXT could be split into several chunks and we'd + ;; miss it. Oh well. It's a best effort anyway. I'd expect that it's + ;; rather unusual to have the prompt split into several packets, but + ;; I'm sure Murphy will prove me wrong. + (when (and shell-dir-cookie-re (string-match shell-dir-cookie-re text)) + (let ((dir (match-string 1 text))) + (cond + ((file-name-absolute-p dir) (shell-cd dir)) + ;; Let's try and see if it seems to be up or down from where we were. + ((string-match "\\`\\(.*\\)\\(?:/.*\\)?\n\\(.*/\\)\\1\\(?:/.*\\)?\\'" + (setq text (concat dir "\n" default-directory))) + (shell-cd (concat (match-string 2 text) dir))))))) + + (defun shell-directory-tracker (str) "Tracks cd, pushd and popd commands issued to the shell. This function is called on each input passed to the shell. ------------------------------------------------------------ revno: 102364 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2010-11-12 08:44:46 -0500 message: * lisp/vc/vc.el (vc-deduce-backend): Use default-directory in shell-mode and compilation-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 13:35:36 +0000 +++ lisp/ChangeLog 2010-11-12 13:44:46 +0000 @@ -1,5 +1,8 @@ 2010-11-12 Stefan Monnier + * vc/vc.el (vc-deduce-backend): Use default-directory in shell-mode + and compilation-mode (bug#7350). + * vc/smerge-mode.el (smerge-refine): Choose better default part to highlight when one of them is empty. === modified file 'lisp/vc/vc.el' --- lisp/vc/vc.el 2010-11-09 20:07:10 +0000 +++ lisp/vc/vc.el 2010-11-12 13:44:46 +0000 @@ -920,7 +920,8 @@ (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) ((derived-mode-p 'log-view-mode) log-view-vc-backend) ((derived-mode-p 'diff-mode) diff-vc-backend) - ((derived-mode-p 'dired-mode) + ;; Maybe we could even use comint-mode rather than shell-mode? + ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode) (vc-responsible-backend default-directory)) (vc-mode (vc-backend buffer-file-name)))) @@ -986,7 +987,7 @@ (let ((backend (vc-responsible-backend default-directory))) (unless backend (error "Directory not under VC")) (list backend - (dired-map-over-marks (dired-get-filename nil t) nil)))) + (dired-map-over-marks (dired-get-filename nil t) nil)))) (defun vc-ensure-vc-buffer () "Make sure that the current buffer visits a version-controlled file." ------------------------------------------------------------ revno: 102363 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2010-11-12 08:35:36 -0500 message: * lisp/vc/smerge-mode.el (smerge-refine): Choose better default part to highlight when one of them is empty. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 13:33:44 +0000 +++ lisp/ChangeLog 2010-11-12 13:35:36 +0000 @@ -1,5 +1,8 @@ 2010-11-12 Stefan Monnier + * vc/smerge-mode.el (smerge-refine): Choose better default part to + highlight when one of them is empty. + * skeleton.el (skeleton-read): Don't use `newline' since it may strip trailing space. (skeleton-newline): New function. === modified file 'lisp/vc/smerge-mode.el' --- lisp/vc/smerge-mode.el 2010-06-11 19:09:57 +0000 +++ lisp/vc/smerge-mode.el 2010-11-12 13:35:36 +0000 @@ -1009,6 +1009,10 @@ (setq part (cond ((null (match-end 2)) 2) ((eq (match-end 1) (match-end 3)) 1) ((integerp part) part) + ;; If one of the parts is empty, any refinement using + ;; it will be trivial and uninteresting. + ((eq (match-end 1) (match-beginning 1)) 1) + ((eq (match-end 3) (match-beginning 3)) 3) (t 2))) (let ((n1 (if (eq part 1) 2 1)) (n2 (if (eq part 3) 2 3))) ------------------------------------------------------------ revno: 102362 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2010-11-12 08:33:44 -0500 message: * lisp/skeleton.el (skeleton-newline): New function. (skeleton-internal-1): Use it. (skeleton-read): Don't use `newline' since it may strip trailing space. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 13:32:02 +0000 +++ lisp/ChangeLog 2010-11-12 13:33:44 +0000 @@ -1,5 +1,10 @@ 2010-11-12 Stefan Monnier + * skeleton.el (skeleton-read): Don't use `newline' since it may strip + trailing space. + (skeleton-newline): New function. + (skeleton-internal-1): Use it. + * simple.el (open-line): `newline' may strip trailing space. 2010-11-12 Kevin Ryde === modified file 'lisp/skeleton.el' --- lisp/skeleton.el 2010-11-10 04:30:21 +0000 +++ lisp/skeleton.el 2010-11-12 13:33:44 +0000 @@ -299,7 +299,10 @@ (eolp (eolp))) ;; since Emacs doesn't show main window's cursor, do something noticeable (or eolp - (open-line 1)) + ;; We used open-line before, but that can do a lot more than we want, + ;; since it runs self-insert-command. E.g. it may remove spaces + ;; before point. + (save-excursion (insert "\n"))) (unwind-protect (setq prompt (if (stringp prompt) (read-string (format prompt skeleton-subprompt) @@ -352,6 +355,16 @@ (signal 'quit 'recursive) recursive)) +(defun skeleton-newline () + (if (or (eq (point) skeleton-point) + (eq (point) (car skeleton-positions))) + ;; If point is recorded, avoid `newline' since it may do things like + ;; strip trailing spaces, and since recorded points are commonly placed + ;; right after a trailing space, calling `newline' can destroy the + ;; position and renders the recorded position incorrect. + (insert "\n") + (newline))) + (defun skeleton-internal-1 (element &optional literal recursive) (cond ((or (integerp element) (stringp element)) @@ -379,13 +392,13 @@ (if pos (indent-according-to-mode))) (skeleton-newline-indent-rigidly (let ((pt (point))) - (newline) + (skeleton-newline) (indent-to (save-excursion (goto-char pt) (if pos (indent-according-to-mode)) (current-indentation))))) (t (if pos (reindent-then-newline-and-indent) - (newline) + (skeleton-newline) (indent-according-to-mode)))))) ((eq element '>) (if (and skeleton-regions (eq (nth 1 skeleton-il) '_)) ------------------------------------------------------------ revno: 102361 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2010-11-12 08:32:02 -0500 message: * lisp/simple.el (open-line): `newline' may strip trailing space. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 13:28:17 +0000 +++ lisp/ChangeLog 2010-11-12 13:32:02 +0000 @@ -1,3 +1,7 @@ +2010-11-12 Stefan Monnier + + * simple.el (open-line): `newline' may strip trailing space. + 2010-11-12 Kevin Ryde * international/mule-cmds.el (princ-list): Use mapc. === modified file 'lisp/simple.el' --- lisp/simple.el 2010-11-09 05:33:07 +0000 +++ lisp/simple.el 2010-11-12 13:32:02 +0000 @@ -512,7 +512,7 @@ (interactive "*p") (let* ((do-fill-prefix (and fill-prefix (bolp))) (do-left-margin (and (bolp) (> (current-left-margin) 0))) - (loc (point)) + (loc (point-marker)) ;; Don't expand an abbrev before point. (abbrev-mode nil)) (newline n) ------------------------------------------------------------ revno: 102360 author: Kevin Ryde committer: Stefan Monnier branch nick: trunk timestamp: Fri 2010-11-12 08:28:17 -0500 message: * lisp/international/mule-cmds.el (princ-list): Use mapc. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2010-11-12 03:21:38 +0000 +++ lisp/ChangeLog 2010-11-12 13:28:17 +0000 @@ -1,3 +1,7 @@ +2010-11-12 Kevin Ryde + + * international/mule-cmds.el (princ-list): Use mapc. + 2010-11-12 Glenn Morris * emacs-lisp/bytecomp.el (byte-compile-log-buffer): New constant. === modified file 'lisp/international/mule-cmds.el' --- lisp/international/mule-cmds.el 2010-11-09 20:07:10 +0000 +++ lisp/international/mule-cmds.el 2010-11-12 13:28:17 +0000 @@ -2035,7 +2035,7 @@ (defun princ-list (&rest args) "Print all arguments with `princ', then print \"\\n\"." - (while args (princ (car args)) (setq args (cdr args))) + (mapc #'princ args) (princ "\n")) (make-obsolete 'princ-list "use mapc and princ instead" "23.3") ------------------------------------------------------------ revno: 102359 committer: Jan D. branch nick: trunk timestamp: Fri 2010-11-12 10:31:44 +0100 message: Apply XAtom revork patches from Julien Danjou. * xsettings.c (init_xsettings): Use already fetch atoms. * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom from dpyinfo. * xselect.c (Fx_send_client_event): Split and create x_send_client_event. * lisp.h: Do not EXFUN Fx_send_client_event. * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom from dpyinfo. (wm_supports): Use atoms from dpyinfo. (do_ewmh_fullscreen): Use atoms from dpyinfo. (x_ewmh_activate_frame): Use atoms from dpyinfo. (xembed_set_info): Use atoms from dpyinfo. (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED, _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and _NET_ACTIVE_WINDOW, XSETTINGS atoms. Get all atoms in one round-trip. (set_wm_state): Use x_send_client_event rather than Fx_send_client_event, using Atom directly. (x_ewmh_activate_frame): Ditto. (x_set_sticky): Pass atoms to set_wm_state. (do_ewmh_fullscreen): Ditto. * xterm.h (x_display_info): Add Xatom_net_supported, Xatom_net_supporting_wm_check, Xatom_net_active_window, Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID. * xfns.c (Fx_show_tip): Fix typo in docstring. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-11-12 08:46:21 +0000 +++ src/ChangeLog 2010-11-12 09:31:44 +0000 @@ -1,5 +1,36 @@ 2010-11-11 Julien Danjou + * xsettings.c (init_xsettings): Use already fetch atoms. + + * xsmfns.c (create_client_leader_window): Use SM_CLIENT_ID atom + from dpyinfo. + + * xselect.c (Fx_send_client_event): Split and create + x_send_client_event. + + * lisp.h: Do not EXFUN Fx_send_client_event. + + * xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom + from dpyinfo. + (wm_supports): Use atoms from dpyinfo. + (do_ewmh_fullscreen): Use atoms from dpyinfo. + (x_ewmh_activate_frame): Use atoms from dpyinfo. + (xembed_set_info): Use atoms from dpyinfo. + (x_term_init): Fetch _XEMBED_INFO, _NET_SUPPORTED, + _NET_SUPPORTING_WM_CHECK, _NET_WM_WINDOW_OPACITY and + _NET_ACTIVE_WINDOW, XSETTINGS atoms. + Get all atoms in one round-trip. + (set_wm_state): Use x_send_client_event rather than + Fx_send_client_event, using Atom directly. + (x_ewmh_activate_frame): Ditto. + (x_set_sticky): Pass atoms to set_wm_state. + (do_ewmh_fullscreen): Ditto. + + + * xterm.h (x_display_info): Add Xatom_net_supported, + Xatom_net_supporting_wm_check, Xatom_net_active_window, + Xatom_net_wm_window_opacity, Xatom_XEMBED_INFO, SM_CLIENT_ID. + * xfns.c (Fx_show_tip): Fix typo in docstring. 2010-11-11 Stefan Monnier === modified file 'src/lisp.h' --- src/lisp.h 2010-10-31 18:50:02 +0000 +++ src/lisp.h 2010-11-12 09:31:44 +0000 @@ -3600,7 +3600,6 @@ extern void syms_of_xsmfns (void); /* Defined in xselect.c */ -EXFUN (Fx_send_client_event, 6); extern void syms_of_xselect (void); /* Defined in xterm.c */ === modified file 'src/xselect.c' --- src/xselect.c 2010-09-02 09:47:08 +0000 +++ src/xselect.c 2010-11-12 09:31:44 +0000 @@ -2527,6 +2527,18 @@ (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values) { struct x_display_info *dpyinfo = check_x_display_info (display); + + x_send_client_event(display, dest, from, + XInternAtom (dpyinfo->display, SDATA (message_type), False), + format, values); + + return Qnil; +} + +void +x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Atom message_type, Lisp_Object format, Lisp_Object values) +{ + struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; XEvent event; Lisp_Object cons; @@ -2584,8 +2596,7 @@ BLOCK_INPUT; - event.xclient.message_type - = XInternAtom (dpyinfo->display, SDATA (message_type), False); + event.xclient.message_type = message_type; event.xclient.display = dpyinfo->display; /* Some clients (metacity for example) expects sending window to be here @@ -2610,8 +2621,6 @@ } x_uncatch_errors (); UNBLOCK_INPUT; - - return Qnil; } === modified file 'src/xsettings.c' --- src/xsettings.c 2010-07-28 17:34:51 +0000 +++ src/xsettings.c 2010-11-12 09:31:44 +0000 @@ -656,18 +656,10 @@ static void init_xsettings (struct x_display_info *dpyinfo) { - char sel[64]; Display *dpy = dpyinfo->display; BLOCK_INPUT; - sprintf (sel, "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); - dpyinfo->Xatom_xsettings_sel = XInternAtom (dpy, sel, False); - dpyinfo->Xatom_xsettings_prop = XInternAtom (dpy, - "_XSETTINGS_SETTINGS", - False); - dpyinfo->Xatom_xsettings_mgr = XInternAtom (dpy, "MANAGER", False); - /* Select events so we can detect client messages sent when selection owner changes. */ XSelectInput (dpy, dpyinfo->root_window, StructureNotifyMask); === modified file 'src/xsmfns.c' --- src/xsmfns.c 2010-08-11 12:34:46 +0000 +++ src/xsmfns.c 2010-11-12 09:31:44 +0000 @@ -410,8 +410,8 @@ XSetClassHint (dpyinfo->display, w, &class_hints); XStoreName (dpyinfo->display, w, class_hints.res_name); - sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); - XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, + XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID, + XA_STRING, 8, PropModeReplace, (unsigned char *)client_id, strlen (client_id)); dpyinfo->client_leader_window = w; === modified file 'src/xterm.c' --- src/xterm.c 2010-11-09 20:07:10 +0000 +++ src/xterm.c 2010-11-12 09:31:44 +0000 @@ -442,7 +442,6 @@ } #define OPAQUE 0xffffffff -#define OPACITY "_NET_WM_WINDOW_OPACITY" void x_set_frame_alpha (struct frame *f) @@ -486,7 +485,7 @@ unsigned long n, left; x_catch_errors (dpy); - rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False), + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, &data); @@ -504,7 +503,7 @@ } x_catch_errors (dpy); - XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False), + XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opac, 1L); x_uncatch_errors (); @@ -8285,12 +8284,11 @@ http://freedesktop.org/wiki/Specifications/wm-spec. */ static int -wm_supports (struct frame *f, const char *atomname) +wm_supports (struct frame *f, Atom want_atom) { Atom actual_type; unsigned long actual_size, bytes_remaining; int i, rc, actual_format; - Atom prop_atom; Window wmcheck_window; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Window target_window = dpyinfo->root_window; @@ -8298,15 +8296,13 @@ Display *dpy = FRAME_X_DISPLAY (f); unsigned char *tmp_data = NULL; Atom target_type = XA_WINDOW; - Atom want_atom; BLOCK_INPUT; - prop_atom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False); - x_catch_errors (dpy); rc = XGetWindowProperty (dpy, target_window, - prop_atom, 0, max_len, False, target_type, + dpyinfo->Xatom_net_supporting_wm_check, + 0, max_len, False, target_type, &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); @@ -8341,10 +8337,10 @@ dpyinfo->net_supported_window = 0; target_type = XA_ATOM; - prop_atom = XInternAtom (dpy, "_NET_SUPPORTED", False); tmp_data = NULL; rc = XGetWindowProperty (dpy, target_window, - prop_atom, 0, max_len, False, target_type, + dpyinfo->Xatom_net_supported, + 0, max_len, False, target_type, &actual_type, &actual_format, &actual_size, &bytes_remaining, &tmp_data); @@ -8362,7 +8358,6 @@ } rc = 0; - want_atom = XInternAtom (dpy, atomname, False); for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i) rc = dpyinfo->net_supported_atoms[i] == want_atom; @@ -8374,31 +8369,31 @@ } static void -set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2) +set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value) { - const char *atom = "_NET_WM_STATE"; - Fx_send_client_event (frame, make_number (0), frame, - make_unibyte_string (atom, strlen (atom)), - make_number (32), - /* 1 = add, 0 = remove */ + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame)); + + x_send_client_event (frame, make_number (0), frame, + dpyinfo->Xatom_net_wm_state, + make_number (32), + /* 1 = add, 0 = remove */ + Fcons + (make_number (add ? 1 : 0), Fcons - (make_number (add ? 1 : 0), - Fcons - (make_unibyte_string (what, strlen (what)), - what2 != 0 - ? Fcons (make_unibyte_string (what2, strlen (what2)), - Qnil) - : Qnil))); + (atom, + value != 0 ? value : Qnil))); } void x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) { Lisp_Object frame; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); XSETFRAME (frame, f); + set_wm_state (frame, NILP (new_value) ? 0 : 1, - "_NET_WM_STATE_STICKY", NULL); + dpyinfo->Xatom_net_wm_state_sticky, None); } /* Return the current _NET_WM_STATE. @@ -8457,7 +8452,7 @@ else *size_state = FULLSCREEN_HEIGHT; } - else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) + else if (a == dpyinfo->Xatom_net_wm_state_fullscreen) *size_state = FULLSCREEN_BOTH; else if (a == dpyinfo->Xatom_net_wm_state_sticky) *sticky = 1; @@ -8472,7 +8467,8 @@ static int do_ewmh_fullscreen (struct frame *f) { - int have_net_atom = wm_supports (f, "_NET_WM_STATE"); + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); Lisp_Object lval = get_frame_param (f, Qfullscreen); int cur, dummy; @@ -8481,14 +8477,11 @@ /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ if (!have_net_atom) - have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); + have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen); if (have_net_atom && cur != f->want_fullscreen) { Lisp_Object frame; - const char *fs = "_NET_WM_STATE_FULLSCREEN"; - const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ"; - const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT"; XSETFRAME (frame, f); @@ -8500,33 +8493,38 @@ case FULLSCREEN_BOTH: if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED || cur == FULLSCREEN_HEIGHT) - set_wm_state (frame, 0, fw, fh); - set_wm_state (frame, 1, fs, NULL); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None); break; case FULLSCREEN_WIDTH: if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT || cur == FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 0, fs, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, + dpyinfo->Xatom_net_wm_state_maximized_vert); if (cur != FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 1, fw, NULL); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None); break; case FULLSCREEN_HEIGHT: if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 0, fs, fw); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, + dpyinfo->Xatom_net_wm_state_maximized_horz); if (cur != FULLSCREEN_MAXIMIZED) - set_wm_state (frame, 1, fh, NULL); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None); break; case FULLSCREEN_MAXIMIZED: if (cur == FULLSCREEN_BOTH) - set_wm_state (frame, 0, fs, NULL); - set_wm_state (frame, 1, fw, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); + set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); break; case FULLSCREEN_NONE: if (cur == FULLSCREEN_BOTH) - set_wm_state (frame, 0, fs, NULL); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None); else - set_wm_state (frame, 0, fw, fh); + set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz, + dpyinfo->Xatom_net_wm_state_maximized_vert); } f->want_fullscreen = FULLSCREEN_NONE; @@ -8966,17 +8964,17 @@ /* See Window Manager Specification/Extended Window Manager Hints at http://freedesktop.org/wiki/Specifications/wm-spec */ - const char *atom = "_NET_ACTIVE_WINDOW"; - if (f->async_visible && wm_supports (f, atom)) + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window)) { Lisp_Object frame; XSETFRAME (frame, f); - Fx_send_client_event (frame, make_number (0), frame, - make_unibyte_string (atom, strlen (atom)), - make_number (32), - Fcons (make_number (1), - Fcons (make_number (last_user_time), - Qnil))); + x_send_client_event (frame, make_number (0), frame, + dpyinfo->Xatom_net_active_window, + make_number (32), + Fcons (make_number (1), + Fcons (make_number (last_user_time), + Qnil))); } } @@ -8996,13 +8994,13 @@ { Atom atom; unsigned long data[2]; - - atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False); + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); data[0] = XEMBED_VERSION; data[1] = flags; - XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom, + XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), + dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *) data, 2); } @@ -10196,90 +10194,97 @@ dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; } - dpyinfo->Xatom_wm_protocols - = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); - dpyinfo->Xatom_wm_take_focus - = XInternAtom (dpyinfo->display, "WM_TAKE_FOCUS", False); - dpyinfo->Xatom_wm_save_yourself - = XInternAtom (dpyinfo->display, "WM_SAVE_YOURSELF", False); - dpyinfo->Xatom_wm_delete_window - = XInternAtom (dpyinfo->display, "WM_DELETE_WINDOW", False); - dpyinfo->Xatom_wm_change_state - = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False); - dpyinfo->Xatom_wm_configure_denied - = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False); - dpyinfo->Xatom_wm_window_moved - = XInternAtom (dpyinfo->display, "WM_MOVED", False); - dpyinfo->Xatom_wm_client_leader - = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False); - dpyinfo->Xatom_editres - = XInternAtom (dpyinfo->display, "Editres", False); - dpyinfo->Xatom_CLIPBOARD - = XInternAtom (dpyinfo->display, "CLIPBOARD", False); - dpyinfo->Xatom_TIMESTAMP - = XInternAtom (dpyinfo->display, "TIMESTAMP", False); - dpyinfo->Xatom_TEXT - = XInternAtom (dpyinfo->display, "TEXT", False); - dpyinfo->Xatom_COMPOUND_TEXT - = XInternAtom (dpyinfo->display, "COMPOUND_TEXT", False); - dpyinfo->Xatom_UTF8_STRING - = XInternAtom (dpyinfo->display, "UTF8_STRING", False); - dpyinfo->Xatom_DELETE - = XInternAtom (dpyinfo->display, "DELETE", False); - dpyinfo->Xatom_MULTIPLE - = XInternAtom (dpyinfo->display, "MULTIPLE", False); - dpyinfo->Xatom_INCR - = XInternAtom (dpyinfo->display, "INCR", False); - dpyinfo->Xatom_EMACS_TMP - = XInternAtom (dpyinfo->display, "_EMACS_TMP_", False); - dpyinfo->Xatom_TARGETS - = XInternAtom (dpyinfo->display, "TARGETS", False); - dpyinfo->Xatom_NULL - = XInternAtom (dpyinfo->display, "NULL", False); - dpyinfo->Xatom_ATOM_PAIR - = XInternAtom (dpyinfo->display, "ATOM_PAIR", False); - /* For properties of font. */ - dpyinfo->Xatom_PIXEL_SIZE - = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False); - dpyinfo->Xatom_AVERAGE_WIDTH - = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False); - dpyinfo->Xatom_MULE_BASELINE_OFFSET - = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False); - dpyinfo->Xatom_MULE_RELATIVE_COMPOSE - = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False); - dpyinfo->Xatom_MULE_DEFAULT_ASCENT - = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False); - - /* Ghostscript support. */ - dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False); - dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False); - - dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR", - False); - - dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", - False); - - dpyinfo->Xatom_net_wm_state - = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False); - dpyinfo->Xatom_net_wm_state_fullscreen_atom - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False); - dpyinfo->Xatom_net_wm_state_maximized_horz - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); - dpyinfo->Xatom_net_wm_state_maximized_vert - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); - dpyinfo->Xatom_net_wm_state_sticky - = XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False); - dpyinfo->Xatom_net_window_type - = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False); - dpyinfo->Xatom_net_window_type_tooltip - = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False); - dpyinfo->Xatom_net_wm_icon_name - = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False); - dpyinfo->Xatom_net_wm_name - = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False); - dpyinfo->Xatom_net_frame_extents - = XInternAtom (dpyinfo->display, "_NET_FRAME_EXTENTS", False); + { + const struct + { + const char *name; + Atom *atom; + } atom_refs[] = { + { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols }, + { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus }, + { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself }, + { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window }, + { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state }, + { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied }, + { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved }, + { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader }, + { "Editres", &dpyinfo->Xatom_editres }, + { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD }, + { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP }, + { "TEXT", &dpyinfo->Xatom_TEXT }, + { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT }, + { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING }, + { "DELETE", &dpyinfo->Xatom_DELETE }, + { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE }, + { "INCR", &dpyinfo->Xatom_INCR }, + { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP }, + { "TARGETS", &dpyinfo->Xatom_TARGETS }, + { "NULL", &dpyinfo->Xatom_NULL }, + { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR }, + { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO }, + /* For properties of font. */ + { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE }, + { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH }, + { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET }, + { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE }, + { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT }, + /* Ghostscript support. */ + { "DONE", &dpyinfo->Xatom_DONE }, + { "PAGE", &dpyinfo->Xatom_PAGE }, + { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar }, + { "_XEMBED", &dpyinfo->Xatom_XEMBED }, + /* EWMH */ + { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state }, + { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen }, + { "_NET_WM_STATE_MAXIMIZED_HORZ", + &dpyinfo->Xatom_net_wm_state_maximized_horz }, + { "_NET_WM_STATE_MAXIMIZED_VERT", + &dpyinfo->Xatom_net_wm_state_maximized_vert }, + { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky }, + { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type }, + { "_NET_WM_WINDOW_TYPE_TOOLTIP", + &dpyinfo->Xatom_net_window_type_tooltip }, + { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name }, + { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name }, + { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported }, + { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supported }, + { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity }, + { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window }, + { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents }, + /* Session management */ + { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID }, + { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop }, + { "MANAGER", &dpyinfo->Xatom_xsettings_mgr }, + }; + + int i; + const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]); + /* 1 for _XSETTINGS_SN */ + const int total_atom_count = 1 + atom_count; + Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count); + char **atom_names = xmalloc (sizeof (char *) * total_atom_count); + char xsettings_atom_name[64]; + + for (i = 0; i < atom_count; i++) + atom_names[i] = (char *) atom_refs[i].name; + + /* Build _XSETTINGS_SN atom name */ + snprintf (xsettings_atom_name, sizeof (xsettings_atom_name), + "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen)); + atom_names[i] = xsettings_atom_name; + + XInternAtoms (dpyinfo->display, atom_names, total_atom_count, + False, atoms_return); + + for (i = 0; i < atom_count; i++) + *atom_refs[i].atom = atoms_return[i]; + + /* Manual copy of last atom */ + dpyinfo->Xatom_xsettings_sel = atoms_return[i]; + + xfree (atom_names); + xfree (atoms_return); + } dpyinfo->x_dnd_atoms_size = 8; dpyinfo->x_dnd_atoms_length = 0; === modified file 'src/xterm.h' --- src/xterm.h 2010-11-09 20:07:10 +0000 +++ src/xterm.h 2010-11-12 09:31:44 +0000 @@ -270,7 +270,7 @@ Atom Xatom_Scrollbar; /* Atom used in XEmbed client messages. */ - Atom Xatom_XEMBED; + Atom Xatom_XEMBED, Xatom_XEMBED_INFO;; /* The frame (if any) which has the X window that has keyboard focus. Zero if none. This is examined by Ffocus_frame in xfns.c. Note @@ -332,13 +332,15 @@ /* Extended window manager hints, Atoms supported by the window manager and atoms for settig the window type. */ + Atom Xatom_net_supported, Xatom_net_supporting_wm_check; Atom *net_supported_atoms; int nr_net_supported_atoms; Window net_supported_window; Atom Xatom_net_window_type, Xatom_net_window_type_tooltip; + Atom Xatom_net_active_window; /* Atoms dealing with EWMH (i.e. _NET_...) */ - Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen_atom, + Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen, Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert, Xatom_net_wm_state_sticky, Xatom_net_frame_extents; @@ -348,6 +350,11 @@ /* Frame name and icon name */ Atom Xatom_net_wm_name, Xatom_net_wm_icon_name; + /* Frame opacity */ + Atom Xatom_net_wm_window_opacity; + + /* SM */ + Atom Xatom_SM_CLIENT_ID; }; #ifdef HAVE_X_I18N @@ -1011,6 +1018,13 @@ extern void x_handle_selection_event (struct input_event *); extern void x_clear_frame_selections (struct frame *); +extern void x_send_client_event (Lisp_Object display, + Lisp_Object dest, + Lisp_Object from, + Atom message_type, + Lisp_Object format, + Lisp_Object values); + extern int x_handle_dnd_message (struct frame *, XClientMessageEvent *, struct x_display_info *, ------------------------------------------------------------ revno: 102358 committer: Jan D. branch nick: trunk timestamp: Fri 2010-11-12 09:46:21 +0100 message: xfns.c (Fx_show_tip): Fix typo in docstring. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2010-11-11 21:11:17 +0000 +++ src/ChangeLog 2010-11-12 08:46:21 +0000 @@ -1,3 +1,7 @@ +2010-11-11 Julien Danjou + + * xfns.c (Fx_show_tip): Fix typo in docstring. + 2010-11-11 Stefan Monnier * cmds.c (Fself_insert_command): Don't call XFASTINT without checking === modified file 'src/xfns.c' --- src/xfns.c 2010-11-09 20:07:10 +0000 +++ src/xfns.c 2010-11-12 08:46:21 +0000 @@ -5021,7 +5021,7 @@ Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil means use the default timeout of 5 seconds. -If the list of frame parameters PARAMS contains a `left' parameters, +If the list of frame parameters PARMS contains a `left' parameters, the tooltip is displayed at that x-position. Otherwise it is displayed at the mouse position, with offset DX added (default is 5 if DX isn't specified). Likewise for the y-position; if a `top' frame ------------------------------------------------------------ revno: 102357 committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2010-11-12 06:24:47 +0000 message: Fix last change. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2010-11-12 05:59:53 +0000 +++ lisp/gnus/ChangeLog 2010-11-12 06:24:47 +0000 @@ -1,6 +1,8 @@ 2010-11-12 Katsumi Yamaoka - * gnus-art.el (article-treat-non-ascii): Keep text properties. + * gnus-art.el (article-treat-non-ascii): Keep text properties not to + divide an image that's in an html article to two or more when washing + non-ASCII characters in alt text of it. 2010-11-11 Katsumi Yamaoka