commit 3e0fc97befc105caf8d7519f1e6fd84c67a50a35 (HEAD, refs/remotes/origin/master) Author: Boruch Baum Date: Wed Mar 25 21:43:51 2015 -0400 * lisp/bookmark.el (bookmark-show-all-annotations): Sort them Fixes: debbugs:20177 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 56c2b4c..37ac1c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2015-03-26 Boruch Baum (tiny change) + + * bookmark.el (bookmark-show-all-annotations): Sort them (bug#20177). + 2015-03-25 Dmitry Gutov * json.el (json-special-chars): Don't treat `/' specially, there's diff --git a/lisp/bookmark.el b/lisp/bookmark.el index a49ee7e..dc8057e 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -1756,7 +1756,7 @@ if an annotation exists." (save-selected-window (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t) (delete-region (point-min) (point-max)) - (dolist (full-record bookmark-alist) + (dolist (full-record (bookmark-maybe-sort-alist)) (let* ((name (bookmark-name-from-full-record full-record)) (ann (bookmark-get-annotation full-record))) (insert (concat name ":\n")) commit 124ea7763a64719a8d461217d25b7ac5b1cefd18 Author: Paul Eggert Date: Wed Mar 25 18:19:29 2015 -0700 Spelling fixes diff --git a/lisp/window.el b/lisp/window.el index 94fe521..46a7dd0 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8080,13 +8080,13 @@ the given windows." (defun window-adjust-process-window-size-smallest (process windows) "Adjust the process window size of PROCESS. WINDOWS is a list of windows associated with PROCESS. Choose the -smallest area availabe for displaying PROCESS's output." +smallest area available for displaying PROCESS's output." (window-adjust-process-window-size #'min process windows)) (defun window-adjust-process-window-size-largest (process windows) "Adjust the process window size of PROCESS. WINDOWS is a list of windows associated with PROCESS. Choose the -largest area availabe for displaying PROCESS's output." +largest area available for displaying PROCESS's output." (window-adjust-process-window-size #'max process windows)) (defun window--process-window-list () diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 344333a..f8ae73c 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -155,9 +155,9 @@ The optional arguments PROMPT and SECONDS work like in ;; In default mode, each numeric parameter of XTerm's mouse report is ;; a single char, possibly encoded as utf-8. The actual numeric ;; parameter then is obtained by subtracting 32 from the character -;; code. In extendend mode the parameters are returned as decimal -;; string delemited either by semicolons or for the last parameter by -;; one of the characters "m" or "M". If the last character is a "m", +;; code. In extended mode the parameters are returned as decimal +;; string delimited either by semicolons or for the last parameter by +;; one of the characters "m" or "M". If the last character is a "m", ;; then the mouse event was a button release, else it was a button ;; press or a mouse motion. Return value is a cons cell with ;; (NEXT-NUMERIC-PARAMETER . LAST-CHAR) @@ -176,7 +176,7 @@ The optional arguments PROMPT and SECONDS work like in ;; in default mode, and ;; ";" ";" <"M" or "m"> in extended mode. ;; The macro read-number-from-terminal takes care of reading -;; the response parameters appropriatly. The EVENT-CODE differs +;; the response parameters appropriately. The EVENT-CODE differs ;; slightly between default and extended mode. ;; Return a list (EVENT-TYPE-SYMBOL X Y). (defun xterm-mouse--read-event-sequence (&optional extension) commit 58c86059c60bc27e9eadba5735da5a40b47f6005 Author: Dmitry Gutov Date: Wed Mar 25 21:54:29 2015 +0200 Only escape quotation mark, backslash and cntrl U+0000 to U+001F * lisp/json.el (json-special-chars): Don't treat `/' specially, there's no need to. (json-encode-string): Only escape quotation mark, backslash and the control characters U+0000 to U+001F. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d150ba..56c2b4c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2015-03-25 Dmitry Gutov + + * json.el (json-special-chars): Don't treat `/' specially, there's + no need to. + (json-encode-string): Only escape quotation mark, backslash and + the control characters U+0000 to U+001F. + 2015-03-25 Artur Malabarba * emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): diff --git a/lisp/json.el b/lisp/json.el index a1e9bb7..eaf8596 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -258,7 +258,6 @@ representation will be parsed correctly." (defvar json-special-chars '((?\" . ?\") (?\\ . ?\\) - (?/ . ?/) (?b . ?\b) (?f . ?\f) (?n . ?\n) @@ -313,8 +312,9 @@ representation will be parsed correctly." (let ((l (length string)) (start 0) res mb) - ;; Skip over ASCIIish printable characters. - (while (setq mb (string-match "[\"\\/\b\f\n\r\t]\\|[^ -~]" string start)) + ;; Only escape quotation mark, backslash and the control + ;; characters U+0000 to U+001F (RFC 4627, ECMA-404). + (while (setq mb (string-match "[\"\\[:cntrl:]]" string start)) (let* ((c (aref string mb)) (special (rassq c json-special-chars))) (push (substring string start mb) res) diff --git a/test/automated/json-tests.el b/test/automated/json-tests.el index 881c237..fd89b7a 100644 --- a/test/automated/json-tests.el +++ b/test/automated/json-tests.el @@ -35,8 +35,8 @@ (ert-deftest json-encode-string-with-special-chars () (should (equal (json-encode-string "a\n\fb") "\"a\\n\\fb\"")) - (should (equal (json-encode-string "\nasdфывfgh\t") - "\"\\nasd\\u0444\\u044b\\u0432fgh\\t\""))) + (should (equal (json-encode-string "\nasdфыв\u001f\u007ffgh\t") + "\"\\nasdфыв\\u001f\u007ffgh\\t\""))) (ert-deftest json-read-string-with-special-chars () (should (equal (json-read-from-string "\"\\nasd\\u0444\\u044b\\u0432fgh\\t\"") commit 2b828866c2df5ea558283e4c3f4c79a404918bea Author: Stefan Monnier Date: Wed Mar 25 14:28:25 2015 -0400 * etc/TODO: Remove obsolete entries. diff --git a/etc/ChangeLog b/etc/ChangeLog index d6b6e29..f0da3a5 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2015-03-25 Stefan Monnier + + * TODO: Remove obsolete entries. + 2015-03-24 Daniel Colascione * NEWS: Mention change to `process-running-child-p`. diff --git a/etc/TODO b/etc/TODO index 79996e2..2235431 100644 --- a/etc/TODO +++ b/etc/TODO @@ -416,9 +416,6 @@ http://lists.gnu.org/archive/html/emacs-devel/2009-04/msg00034.html ** Allow frames(terminals) created by emacsclient to inherit their environment from the emacsclient process. -** Remove the default toggling behavior of minor modes when called from elisp -rather than interactively. This a trivial one-liner in easy-mode.el. - ** Give Tar mode all the features of Archive mode. ** Create a category of errors called `process-error' @@ -427,9 +424,6 @@ rather than interactively. This a trivial one-liner in easy-mode.el. ** Maybe reinterpret `parse-error' as a category of errors and put some other errors under it. -** A function to tell you the argument pattern of functions. - See `function-arity' in http://www.loveshack.ukfsn.org/emacs/fx-misc.el. - ** Make byte-compile warn when a doc string is too wide. ** Make byte-optimization warnings issue accurate line numbers. @@ -495,9 +489,6 @@ rather than interactively. This a trivial one-liner in easy-mode.el. ** Give start-process the ability to direct standard-error output to a different filter. -** Make desktop.el save the "frame configuration" of Emacs (in some - useful sense). - ** Give desktop.el a feature to switch between different named desktops. ** Add a cpio mode, more or less like tar mode. @@ -523,23 +514,10 @@ rather than interactively. This a trivial one-liner in easy-mode.el. Check the assignments file for other packages which might go in and have been missed. -** Make keymaps a first-class Lisp object (this means a rewrite of - keymap.c). What should it do apart from being opaque ? - multiple inheritance ? faster where-is ? no more fix_submap_inheritance ? - what else ? - -** Implement popular parts of the rest of the CL functions as compiler - macros in cl-macs. [Is this still relevant now that cl-lib exists?] - ** Make compiler warnings about functions that might be undefined at run time smarter, so that they know which files are required by the file being compiled and don't warn about functions defined in them. -** Highlight rectangles (`mouse-track-rectangle-p' in XEmacs). Already in CUA, - but it's a valuable feature worth making more general. - [Basic support added 2013/10: - http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00904.html ] - ** Split out parts of lisp.h. ** Update the FAQ. @@ -547,11 +525,6 @@ rather than interactively. This a trivial one-liner in easy-mode.el. ** Allow auto-compression-mode to use zlib calls if zlib is available. [It's required for PNG, so may be linked anyhow.] -** Add a --pristine startup flag which does -q --no-site-file plus - ignoring X resources (Doze equivalents?) and most of the - environment. What should not be ignored needs consideration. - [Do the existing -Q and -D cover this, or is more needed?] - ** Improve the GC (generational, incremental). (We may be able to use the Boehm collector.) [See the Boehm-GC branch in CVS for work on this.] @@ -578,20 +551,9 @@ rather than interactively. This a trivial one-liner in easy-mode.el. (Requires recursing through display properties). Provide some way to simulate mouse-clicks on marginal text without a mouse. -** Implement Lisp functions to determine properly whether a character - is displayable (particularly needed in XFree 4, sigh). Use it to - define useful glyphs that may be displayed as images or unicodes - (with ASCIIfied fallback via latin1-disp). Examples include - box-drawing graphics in Custom buffers, W3 rules and tables, and - tree displays generally, mode-line mail indicator. [See work done - already for Emacs 23 and consult fx.] - ** Extend ps-print to deal with multiple font sizes, images, and extra encodings. -** Make byte-compile avoid binding an expanded defsubst's args - when the body only calls primitives. - ** Use the XIE X extension, if available, for image display. ** Make monochrome images display using the foreground and background diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index e0d6c3e..081ea31 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -393,7 +393,7 @@ ACCESS-TYPE if non-nil should specify the kind of access that will trigger This uses `defvaralias' and `make-obsolete-variable' (which see). See the Info node `(elisp)Variable Aliases' for more details. -If CURRENT-NAME is a defcustom (more generally, any variable +If CURRENT-NAME is a defcustom or a defvar (more generally, any variable where OBSOLETE-NAME may be set, e.g. in an init file, before the alias is defined), then the define-obsolete-variable-alias statement should be evaluated before the defcustom, if user @@ -407,7 +407,7 @@ variable (this is due to the way `defvaralias' works). For the benefit of `custom-set-variables', if OBSOLETE-NAME has any of the following properties, they are copied to CURRENT-NAME, if it does not already have them: -'saved-value, 'saved-variable-comment." +`saved-value', `saved-variable-comment'." (declare (doc-string 4) (advertised-calling-convention ;; New code should always provide the `when' argument. commit eeb515715d50e55477b6bc9c5a64fbb57dfaec94 Author: Artur Malabarba Date: Wed Mar 25 17:48:15 2015 +0000 emacs-lisp/checkdoc.el: Don't complain about args starting with _. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e747330..2d150ba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-03-25 Artur Malabarba + + * emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): + Don't complain about args starting with _. + 2015-03-25 Stefan Monnier * international/mule-cmds.el (mule--ucs-names-annotation): New func. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 288e25e..777fed0 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -1663,14 +1663,15 @@ function,command,variable,option or symbol." ms1)))))) ;; Addendum: Make sure they appear in the doc in the same ;; order that they are found in the arg list. - (let ((args (cdr (cdr (cdr (cdr fp))))) + (let ((args (nthcdr 4 fp)) (last-pos 0) (found 1) (order (and (nth 3 fp) (car (nth 3 fp)))) (nocheck (append '("&optional" "&rest") (nth 3 fp))) (inopts nil)) (while (and args found (> found last-pos)) - (if (member (car args) nocheck) + (if (or (member (car args) nocheck) + (string-match "\\`_" (car args))) (setq args (cdr args) inopts t) (setq last-pos found commit 7c4a0e3b46dff5ccd2233c24ac0143d3f30747ff Author: Stefan Monnier Date: Wed Mar 25 13:45:34 2015 -0400 * international/mule-cmds.el: Show chars in C-x 8 RET completions * lisp/international/mule-cmds.el (mule--ucs-names-annotation): New func. (read-char-by-name): Use it. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 91decb3..e747330 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2015-03-25 Stefan Monnier + * international/mule-cmds.el (mule--ucs-names-annotation): New func. + (read-char-by-name): Use it. + * xt-mouse.el (xterm-mouse--read-number-from-terminal): Fix last commit. 2015-03-25 Nicolas Petton diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index dcf850d..cca659f 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2941,6 +2941,14 @@ on encoding." ;; char with that name. (setq ucs-names `(("BELL (BEL)" . 7) ,@names))))) +(defun mule--ucs-names-annotation (name) + ;; FIXME: It would be much better to add this annotation before rather than + ;; after the char name, so the annotations are aligned. + ;; FIXME: The default behavior of displaying annotations in italics + ;; doesn't work well here. + (let ((char (assoc name ucs-names))) + (when char (format " (%c)" (cdr char))))) + (defun read-char-by-name (prompt) "Read a character by its Unicode name or hex number string. Display PROMPT and read a string that represents a character by its @@ -2964,7 +2972,9 @@ point or a number in hash notation, e.g. #o21430 for octal, prompt (lambda (string pred action) (if (eq action 'metadata) - '(metadata (category . unicode-name)) + '(metadata + (annotation-function . mule--ucs-names-annotation) + (category . unicode-name)) (complete-with-action action (ucs-names) string pred))))) (char (cond commit 599ca626d760215b090012c69c749d391cfd6fbe Author: Stefan Monnier Date: Wed Mar 25 09:47:12 2015 -0400 `save-excursion' does not save&restore the mark any more * src/editfns.c (save_excursion_save): Don't save the mark. (save_excursion_restore): Don't restore the mark. (Fsave_excursion): Fix docstring accordingly. * doc/lispintro/emacs-lisp-intro.texi: * doc/lispref/positions.texi (Excursions, Narrowing): `save-excursion' does not save&restore the mark any more. diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog index 57ab03b..c54c165 100644 --- a/doc/lispintro/ChangeLog +++ b/doc/lispintro/ChangeLog @@ -1,3 +1,7 @@ +2015-03-25 Stefan Monnier + + * emacs-lisp-intro.texi: `save-excursion' doesn't save&restore the mark. + 2014-12-31 Paul Eggert Less 'make' chatter for Emacs doc diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index c67623d..ed125bb 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -352,7 +352,7 @@ How To Write Function Definitions * if:: What if? * else:: If--then--else expressions. * Truth & Falsehood:: What Lisp considers false and true. -* save-excursion:: Keeping track of point, mark, and buffer. +* save-excursion:: Keeping track of point and buffer. * Review:: * defun Exercises:: @@ -2966,7 +2966,7 @@ symbol refers to it.) * if:: What if? * else:: If--then--else expressions. * Truth & Falsehood:: What Lisp considers false and true. -* save-excursion:: Keeping track of point, mark, and buffer. +* save-excursion:: Keeping track of point and buffer. * Review:: * defun Exercises:: @end menu @@ -4159,11 +4159,11 @@ The @code{save-excursion} function is the third and final special form that we will discuss in this chapter. In Emacs Lisp programs used for editing, the @code{save-excursion} -function is very common. It saves the location of point and mark, -executes the body of the function, and then restores point and mark to -their previous positions if their locations were changed. Its primary +function is very common. It saves the location of point, +executes the body of the function, and then restores point to +its previous position if its location was changed. Its primary purpose is to keep the user from being surprised and disturbed by -unexpected movement of point or mark. +unexpected movement of point. @menu * Point and mark:: A review of various locations. @@ -4201,7 +4201,7 @@ region}. Numerous commands work on the region, including @code{print-region}. The @code{save-excursion} special form saves the locations of point and -mark and restores those positions after the code within the body of the +restores this position after the code within the body of the special form is evaluated by the Lisp interpreter. Thus, if point were in the beginning of a piece of text and some code moved point to the end of the buffer, the @code{save-excursion} would put point back to where @@ -4212,16 +4212,16 @@ In Emacs, a function frequently moves point as part of its internal workings even though a user would not expect this. For example, @code{count-lines-region} moves point. To prevent the user from being bothered by jumps that are both unexpected and (from the user's point of -view) unnecessary, @code{save-excursion} is often used to keep point and -mark in the location expected by the user. The use of +view) unnecessary, @code{save-excursion} is often used to keep point in +the location expected by the user. The use of @code{save-excursion} is good housekeeping. To make sure the house stays clean, @code{save-excursion} restores the -values of point and mark even if something goes wrong in the code inside +value of point even if something goes wrong in the code inside of it (or, to be more precise and to use the proper jargon, ``in case of abnormal exit''). This feature is very helpful. -In addition to recording the values of point and mark, +In addition to recording the value of point, @code{save-excursion} keeps track of the current buffer, and restores it, too. This means you can write code that will change the buffer and have @code{save-excursion} switch you back to the original buffer. @@ -4386,9 +4386,9 @@ For example, @end smallexample @item save-excursion -Record the values of point and mark and the current buffer before -evaluating the body of this special form. Restore the values of point -and mark and buffer afterward. +Record the values of point and the current buffer before +evaluating the body of this special form. Restore the value of point and +buffer afterward. @need 1250 For example, @@ -5201,8 +5201,8 @@ of the two-element list, @code{(oldbuf (current-buffer))}. The body of the @code{let} expression in @code{append-to-buffer} consists of a @code{save-excursion} expression. -The @code{save-excursion} function saves the locations of point and -mark, and restores them to those positions after the expressions in the +The @code{save-excursion} function saves the location of point, and restores it +to that position after the expressions in the body of the @code{save-excursion} complete execution. In addition, @code{save-excursion} keeps track of the original buffer, and restores it. This is how @code{save-excursion} is used in @@ -5390,7 +5390,7 @@ Conventionally bound to @kbd{M-.} (that's a period following the @key{META} key). @item save-excursion -Save the location of point and mark and restore their values after the +Save the location of point and restore its value after the arguments to @code{save-excursion} have been evaluated. Also, remember the current buffer and return to it. @@ -5896,7 +5896,7 @@ the value of point, which will be at the end of the inserted text, is recorded in the variable @code{newmark}. After the body of the outer @code{save-excursion} is evaluated, point -and mark are relocated to their original places. +is relocated to its original place. However, it is convenient to locate a mark at the end of the newly inserted text and locate point at its beginning. The @code{newmark} @@ -6685,8 +6685,8 @@ restored just before the completion of the function by the @code{save-restriction} special form. The call to @code{widen} is followed by @code{save-excursion}, which -saves the location of the cursor (i.e., of point) and of the mark, and -restores them after the code in the body of the @code{save-excursion} +saves the location of the cursor (i.e., of point), and +restores it after the code in the body of the @code{save-excursion} uses the @code{beginning-of-line} function to move point. (Note that the @code{(widen)} expression comes between the @@ -6757,8 +6757,8 @@ it, and @code{count-lines} counts only the lines @emph{before} the current line. After @code{count-lines} has done its job, and the message has been -printed in the echo area, the @code{save-excursion} restores point and -mark to their original positions; and @code{save-restriction} restores +printed in the echo area, the @code{save-excursion} restores point to +its original position; and @code{save-restriction} restores the original narrowing, if any. @node narrow Exercise diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9b1bbb3..9e1b7b0 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2015-03-25 Stefan Monnier + + * positions.texi (Excursions, Narrowing): `save-excursion' does not + save&restore the mark any more. + 2015-03-24 Paul Eggert * numbers.texi (Float Basics): Improve ldexp documentation. diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index b74116e..103161c 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -825,8 +825,8 @@ is zero or less. It is often useful to move point ``temporarily'' within a localized portion of the program. This is called an @dfn{excursion}, and it is done with the @code{save-excursion} special form. This construct -remembers the initial identity of the current buffer, and its values -of point and the mark, and restores them after the excursion +remembers the initial identity of the current buffer, and its value +of point, and restores them after the excursion completes. It is the standard way to move point within one part of a program and avoid affecting the rest of the program, and is used thousands of times in the Lisp sources of Emacs. @@ -841,18 +841,18 @@ Configurations} and in @ref{Frame Configurations}. @c frameset? @cindex mark excursion @cindex point excursion This special form saves the identity of the current buffer and the -values of point and the mark in it, evaluates @var{body}, and finally -restores the buffer and its saved values of point and the mark. All -three saved values are restored even in case of an abnormal exit via +value of point in it, evaluates @var{body}, and finally +restores the buffer and its saved value of point. both saved values are +restored even in case of an abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). The value returned by @code{save-excursion} is the result of the last form in @var{body}, or @code{nil} if no body forms were given. @end defspec - Because @code{save-excursion} only saves point and mark for the + Because @code{save-excursion} only saves point for the buffer that was current at the start of the excursion, any changes -made to point and/or mark in other buffers, during the excursion, will +made to point in other buffers, during the excursion, will remain in effect afterward. This frequently leads to unintended consequences, so the byte compiler warns if you call @code{set-buffer} during an excursion: @@ -888,11 +888,6 @@ type @code{nil}. @xref{Marker Insertion Types}. Therefore, when the saved point value is restored, it normally comes before the inserted text. - Although @code{save-excursion} saves the location of the mark, it does -not prevent functions which modify the buffer from setting -@code{deactivate-mark}, and thus causing the deactivation of the mark -after the command finishes. @xref{The Mark}. - @node Narrowing @section Narrowing @cindex narrowing @@ -980,7 +975,7 @@ restores the restrictions on the original buffer (the buffer whose restrictions it saved from), but it does not restore the identity of the current buffer. -@code{save-restriction} does @emph{not} restore point and the mark; use +@code{save-restriction} does @emph{not} restore point; use @code{save-excursion} for that. If you use both @code{save-restriction} and @code{save-excursion} together, @code{save-excursion} should come first (on the outside). Otherwise, the old point value would be diff --git a/etc/NEWS b/etc/NEWS index 45d5ab3..396335e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -617,6 +617,8 @@ a typographically-correct documents. * Incompatible Lisp Changes in Emacs 25.1 +** `save-excursion' does not save&restore the mark any more. + ** read-buffer-function can now be called with a 4th argument (`predicate'). ** completion-table-dynamic stays in the minibuffer. diff --git a/src/ChangeLog b/src/ChangeLog index 23f125c..632b798 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2015-03-25 Stefan Monnier + + * editfns.c (save_excursion_save): Don't save the mark. + (save_excursion_restore): Don't restore the mark. + (Fsave_excursion): Fix docstring accordingly. + 2015-03-24 Paul Eggert Fix minor ldexp issues diff --git a/src/editfns.c b/src/editfns.c index 7c146f1..f463890 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -849,14 +849,11 @@ save_excursion_save (void) { return make_save_obj_obj_obj_obj (Fpoint_marker (), - /* Do not copy the mark if it points to nowhere. */ - (XMARKER (BVAR (current_buffer, mark))->buffer - ? Fcopy_marker (BVAR (current_buffer, mark), Qnil) - : Qnil), + Qnil, /* Selected window if current buffer is shown in it, nil otherwise. */ (EQ (XWINDOW (selected_window)->contents, Fcurrent_buffer ()) ? selected_window : Qnil), - BVAR (current_buffer, mark_active)); + Qnil); } /* Restore saved buffer before leaving `save-excursion' special form. */ @@ -864,8 +861,8 @@ save_excursion_save (void) void save_excursion_restore (Lisp_Object info) { - Lisp_Object tem, tem1, omark, nmark; - struct gcpro gcpro1, gcpro2, gcpro3; + Lisp_Object tem, tem1; + struct gcpro gcpro1; tem = Fmarker_buffer (XSAVE_OBJECT (info, 0)); /* If we're unwinding to top level, saved buffer may be deleted. This @@ -873,8 +870,7 @@ save_excursion_restore (Lisp_Object info) if (NILP (tem)) goto out; - omark = nmark = Qnil; - GCPRO3 (info, omark, nmark); + GCPRO1 (info); Fset_buffer (tem); @@ -883,34 +879,6 @@ save_excursion_restore (Lisp_Object info) Fgoto_char (tem); unchain_marker (XMARKER (tem)); - /* Mark marker. */ - tem = XSAVE_OBJECT (info, 1); - omark = Fmarker_position (BVAR (current_buffer, mark)); - if (NILP (tem)) - unchain_marker (XMARKER (BVAR (current_buffer, mark))); - else - { - Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ()); - nmark = Fmarker_position (tem); - unchain_marker (XMARKER (tem)); - } - - /* Mark active. */ - tem = XSAVE_OBJECT (info, 3); - tem1 = BVAR (current_buffer, mark_active); - bset_mark_active (current_buffer, tem); - - /* If mark is active now, and either was not active - or was at a different place, run the activate hook. */ - if (! NILP (tem)) - { - if (! EQ (omark, nmark)) - run_hook (intern ("activate-mark-hook")); - } - /* If mark has ceased to be active, run deactivate hook. */ - else if (! NILP (tem1)) - run_hook (intern ("deactivate-mark-hook")); - /* If buffer was visible in a window, and a different window was selected, and the old selected window is still showing this buffer, restore point in that window. */ @@ -932,18 +900,12 @@ save_excursion_restore (Lisp_Object info) } DEFUN ("save-excursion", Fsave_excursion, Ssave_excursion, 0, UNEVALLED, 0, - doc: /* Save point, mark, and current buffer; execute BODY; restore those things. + doc: /* Save point, and current buffer; execute BODY; restore those things. Executes BODY just like `progn'. -The values of point, mark and the current buffer are restored +The values of point and the current buffer are restored even in case of abnormal exit (throw or error). -The state of activation of the mark is also restored. - -This construct does not save `deactivate-mark', and therefore -functions that change the buffer will still cause deactivation -of the mark at the end of the command. To prevent that, bind -`deactivate-mark' with `let'. -If you only want to save the current buffer but not point nor mark, +If you only want to save the current buffer but not point, then just use `save-current-buffer', or even `with-current-buffer'. usage: (save-excursion &rest BODY) */) commit 76040ddd8a4142e2933f1c24940d9e20c206ee6f Author: Stefan Monnier Date: Wed Mar 25 09:34:20 2015 -0400 * lisp/xt-mouse.el (xterm-mouse--read-number-from-terminal): Fix last commit. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4fb1999..91decb3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2015-03-25 Stefan Monnier + + * xt-mouse.el (xterm-mouse--read-number-from-terminal): Fix last commit. + 2015-03-25 Nicolas Petton * emacs-lisp/seq.el: Documentation improvements. diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 7f1e722..344333a 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -170,7 +170,7 @@ The optional arguments PROMPT and SECONDS work like in (<= ?0 c ?9)) (setq n (+ (* 10 n) c (- ?0)))) (cons n c)) - (cons (- (setq c (read-utf8-char)) 32) c)))) + (cons (- (setq c (xterm-mouse--read-utf8-char)) 32) c)))) ;; XTerm reports mouse events as ;; in default mode, and commit 176d864cbfb4110eff983dd0053b8401fb76e82c Author: Stefan Monnier Date: Wed Mar 25 08:53:44 2015 -0400 * lisp/erc/erc.el (erc-switch-to-buffer): Fix last change. Fixes: debbugs:20187 diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index e75b8cc..a4a7d47 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,7 @@ +2015-03-25 Stefan Monnier + + * erc.el (erc-switch-to-buffer): Fix last change (bug#20187). + 2015-03-16 Stefan Monnier * erc.el (erc-switch-to-buffer): Rename from erc-iswitchb and rewrite diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 7e76a6d..cf422f1 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1717,7 +1717,8 @@ If `erc-track-mode' is in enabled, put the last element of ;; Only allow ERC buffers in the same session. (let ((proc (unless arg erc-server-process))) (lambda (bufname) - (let ((buf (get-buffer bufname))) + (let ((buf (if (consp bufname) + (cdr bufname) (get-buffer bufname)))) (when buf (erc--buffer-p buf (lambda () t) proc) (with-current-buffer buf