From 418b1830241ccc5ce4e3574c80d714ec0427fa4c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 15:43:47 -0800 Subject: [PATCH 01/23] Add missing make-local-variable calls in srt-mode.el * lisp/cedet/srecode/srt-mode.el (srecode-template-mode): Don't change global values of comment-start, comment-end. Fixes: debbugs:12781 --- lisp/cedet/ChangeLog | 5 +++++ lisp/cedet/srecode/srt-mode.el | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 6f2669e9fee..55fce80e18b 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,8 @@ +2012-11-10 Glenn Morris + + * srecode/srt-mode.el (srecode-template-mode): + Don't change global values of comment-start, comment-end. (Bug#12781) + 2012-10-25 David Engster * semantic/analyze.el (semantic-analyze-dereference-alias): New diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el index 12fc08b90e4..298c8949435 100644 --- a/lisp/cedet/srecode/srt-mode.el +++ b/lisp/cedet/srecode/srt-mode.el @@ -189,8 +189,8 @@ we can tell font lock about them.") ;;;###autoload (define-derived-mode srecode-template-mode fundamental-mode "SRecorder" "Major-mode for writing SRecode macros." - (setq comment-start ";;" - comment-end "") + (set (make-local-variable 'comment-start) ";;") + (set (make-local-variable 'comment-end) "") (set (make-local-variable 'parse-sexp-ignore-comments) t) (set (make-local-variable 'comment-start-skip) "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") From 6efddf785187007804e677c3834b9d6ab18ffc86 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 16:20:51 -0800 Subject: [PATCH 02/23] Formatting tweak for variables.texi * doc/lispref/variables.texi (Adding Generalized Variables): Use standard formatting for common lisp note about setf functions. --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/variables.texi | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index eba44b5743d..9dd833a4328 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2012-11-11 Glenn Morris + + * variables.texi (Adding Generalized Variables): + Use standard formatting for common lisp note about setf functions. + 2012-11-07 Martin Rudalics * elisp.texi (Top): Add Recombining Windows to menu. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index c8451527d4f..814c5e2dd1c 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2141,12 +2141,14 @@ This is the most general way to define a new @code{setf} expansion. @end ignore @cindex CL note---no @code{setf} functions -Common Lisp defines another way to specify the @code{setf} behavior of -a function, namely ``@code{setf} functions'', whose names are lists -@code{(setf @var{name})} rather than symbols. For example, -@code{(defun (setf foo) @dots{})} defines the function that is used -when @code{setf} is applied to @code{foo}. Emacs does not support -this. It is a compile-time error to use @code{setf} on a form that -has not already had an appropriate expansion defined. In Common Lisp, -this is not an error since the function @code{(setf @var{func})} might -be defined later. +@quotation +@b{Common Lisp note:} Common Lisp defines another way to specify the +@code{setf} behavior of a function, namely ``@code{setf} functions'', +whose names are lists @code{(setf @var{name})} rather than symbols. +For example, @code{(defun (setf foo) @dots{})} defines the function +that is used when @code{setf} is applied to @code{foo}. Emacs does +not support this. It is a compile-time error to use @code{setf} on a +form that has not already had an appropriate expansion defined. In +Common Lisp, this is not an error since the function @code{(setf +@var{func})} might be defined later. +@end quotation From 38868ad716a4d33a81fbaeea17fc0ee64616252c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 16:37:40 -0800 Subject: [PATCH 03/23] Document new error symbol and function user-error * doc/lispref/control.texi (Signaling Errors): * doc/lispref/debugging.texi (Error Debugging): * doc/lispref/errors.texi (Standard Errors): Add user-error. * etc/NEWS: Related markup. --- doc/lispref/ChangeLog | 4 ++++ doc/lispref/control.texi | 13 +++++++++++++ doc/lispref/debugging.texi | 12 ++++++------ doc/lispref/errors.texi | 3 +++ etc/NEWS | 1 + 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9dd833a4328..bc48f74401f 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,5 +1,9 @@ 2012-11-11 Glenn Morris + * control.texi (Signaling Errors): + * debugging.texi (Error Debugging): + * errors.texi (Standard Errors): Add user-error. + * variables.texi (Adding Generalized Variables): Use standard formatting for common lisp note about setf functions. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index cf393b59c49..489e5cc5b22 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -824,6 +824,19 @@ The function @code{signal} never returns. @end example @end defun +@cindex user errors, signaling +@defun user-error format-string &rest args +This function behaves exactly like @code{error}, except that it uses +the error symbol @code{user-error} rather than @code{error}. As the +name suggests, this is intended to report errors on the part of the +user, rather than errors in the code itself. For example, +if you try to use the command @code{Info-history-back} (@kbd{l}) to +move back beyond the start of your Info browsing history, Emacs +signals a @code{user-error}. Such errors do not cause entry to the +debugger, even when @code{debug-on-error} is non-@code{nil}. +@xref{Error Debugging}. +@end defun + @cindex CL note---no continuable errors @quotation @b{Common Lisp note:} Emacs Lisp has nothing like the Common Lisp diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 2226db942d1..74000c2ba66 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -117,12 +117,12 @@ has any of those condition symbols, or if the error message matches any of the regular expressions, then that error does not enter the debugger. -The normal value of this variable lists several errors that happen -often during editing but rarely result from bugs in Lisp programs. -However, ``rarely'' is not ``never''; if your program fails with an -error that matches this list, you may try changing this list to debug -the error. The easiest way is usually to set -@code{debug-ignored-errors} to @code{nil}. +The normal value of this variable includes @code{user-error}, as well +as several errors that happen often during editing but rarely result +from bugs in Lisp programs. However, ``rarely'' is not ``never''; if +your program fails with an error that matches this list, you may try +changing this list to debug the error. The easiest way is usually to +set @code{debug-ignored-errors} to @code{nil}. @end defopt @defopt eval-expression-debug-on-error diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index a57f74d6c86..b92fd9ed665 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -172,6 +172,9 @@ The message is @samp{Text is read-only}. This is a subcategory of @item undefined-color The message is @samp{Undefined color}. @xref{Color Names}. +@item user-error +The message is the empty string. @xref{Signaling Errors}. + @item void-function The message is @samp{Symbol's function definition is void}. @xref{Function Cells}. diff --git a/etc/NEWS b/etc/NEWS index 985bedf2960..6ab23a4239d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -800,6 +800,7 @@ table, but with a different prefix. ** Debugger changes ++++ *** New error type and new function `user-error'. These do not trigger the debugger. From 68146aa5abeb41ea6f535e6d2cad6a5211ba49e0 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 16:40:37 -0800 Subject: [PATCH 04/23] * lisp/emacs-lisp/debug.el (debugger-bury-or-kill): Fix :version. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/debug.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 542c80abeec..88ecfddffb2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-11-11 Glenn Morris + + * emacs-lisp/debug.el (debugger-bury-or-kill): Fix :version. + 2012-11-10 Leo Liu * ido.el (ido-set-matches-1): Fix split-string args to avoid diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index c04e68c0cfa..1117d11e07e 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -79,7 +79,7 @@ The value used here is passed to `quit-restore-window'." (const :tag "Bury" bury) (const :tag "Kill" kill)) :group 'debugger - :version "24.2") + :version "24.3") (defvar debug-function-list nil "List of functions currently set for debug on entry.") From 6ba6a3e51f72d00d89583b86349b918b5ff3e793 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 16:43:54 -0800 Subject: [PATCH 05/23] Fix more custom :versions * lisp/help.el (temp-buffer-max-height): * lisp/window.el (fit-frame-to-buffer, fit-frame-to-buffer-bottom-margin): Fix :version. --- lisp/ChangeLog | 2 ++ lisp/help.el | 2 +- lisp/window.el | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 88ecfddffb2..0207a4f903f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-11-11 Glenn Morris + * help.el (temp-buffer-max-height): + * window.el (fit-frame-to-buffer, fit-frame-to-buffer-bottom-margin): * emacs-lisp/debug.el (debugger-bury-or-kill): Fix :version. 2012-11-10 Leo Liu diff --git a/lisp/help.el b/lisp/help.el index 449818207b3..de2a22714f9 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -979,7 +979,7 @@ buffer, and should return a positive integer. At the time the function is called, the window to be resized is selected." :type '(choice integer function) :group 'help - :version "24.2") + :version "24.3") (define-minor-mode temp-buffer-resize-mode "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode). diff --git a/lisp/window.el b/lisp/window.el index be6ddf8ab9e..b3a66ca1dd3 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -6065,7 +6065,7 @@ A frame can be resized if and only if its root window is a live window. The height of the root window is subject to the values of `fit-frame-to-buffer-max-height' and `window-min-height'." :type 'boolean - :version "24.2" + :version "24.3" :group 'help) (defcustom fit-frame-to-buffer-bottom-margin 4 @@ -6073,7 +6073,7 @@ of `fit-frame-to-buffer-max-height' and `window-min-height'." This is the number of lines `fit-frame-to-buffer' leaves free at the bottom of the display in order to not obscure the system task bar." :type 'integer - :version "24.2" + :version "24.3" :group 'windows) (defun fit-frame-to-buffer (&optional frame max-height min-height) From 164f28b577c860f9a48733952fb5baaf8826eb9d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 16:58:51 -0800 Subject: [PATCH 06/23] * doc/lispref/debugging.texi (Error Debugging): Mention debug-on-message. * etc/NEWS: Related markup. --- doc/lispref/ChangeLog | 2 ++ doc/lispref/debugging.texi | 8 ++++++++ etc/NEWS | 1 + 3 files changed, 11 insertions(+) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index bc48f74401f..0016258bcb5 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,5 +1,7 @@ 2012-11-11 Glenn Morris + * debugging.texi (Error Debugging): Mention debug-on-message. + * control.texi (Signaling Errors): * debugging.texi (Error Debugging): * errors.texi (Standard Errors): Add user-error. diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 74000c2ba66..9a43cfeac5d 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -163,6 +163,14 @@ supported values correspond to the signals @code{SIGUSR1} and @code{inhibit-quit} is set and Emacs is not otherwise responding. @end defopt +@cindex message, finding what causes a particular message +@defvar debug-on-message +If you set @code{debug-on-message} to a regular expression, +Emacs will enter the debugger if it displays a matching message in the +echo area. For example, this can be useful when trying to find the +cause of a particular message. +@end defvar + To debug an error that happens during loading of the init file, use the option @samp{--debug-init}. This binds @code{debug-on-error} to @code{t} while loading the init file, and diff --git a/etc/NEWS b/etc/NEWS index 6ab23a4239d..42c639ef25b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -806,6 +806,7 @@ These do not trigger the debugger. *** New option `debugger-bury-or-kill'. ++++ *** Set `debug-on-message' to enter the debugger when a certain message is displayed in the echo area. This can be useful when trying to work out which code is doing something. From 57fc0fee5fd12dd5b43323d127fea62040c01c79 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 17:16:25 -0800 Subject: [PATCH 07/23] Document debugger-bury-or-kill * doc/lispref/debugging.texi (Using Debugger): Mention debugger-bury-or-kill. * lisp/emacs-lisp/debug.el (debugger-bury-or-kill): Doc tweak. * etc/NEWS: Related edit. --- doc/lispref/ChangeLog | 1 + doc/lispref/debugging.texi | 9 +++++++-- etc/NEWS | 4 +++- lisp/ChangeLog | 2 ++ lisp/emacs-lisp/debug.el | 6 +++--- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 0016258bcb5..9d101722388 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,6 +1,7 @@ 2012-11-11 Glenn Morris * debugging.texi (Error Debugging): Mention debug-on-message. + (Using Debugger): Mention debugger-bury-or-kill. * control.texi (Signaling Errors): * debugging.texi (Error Debugging): diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 9a43cfeac5d..11532b19781 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -322,6 +322,7 @@ is a message describing the reason that the debugger was invoked (such as the error message and associated data, if it was invoked due to an error). +@vindex debugger-bury-or-kill The backtrace buffer is read-only and uses a special major mode, Debugger mode, in which letters are defined as debugger commands. The usual Emacs editing commands are available; thus, you can switch windows @@ -330,8 +331,12 @@ switch buffers, visit files, or do any other sort of editing. However, the debugger is a recursive editing level (@pxref{Recursive Editing}) and it is wise to go back to the backtrace buffer and exit the debugger (with the @kbd{q} command) when you are finished with it. Exiting -the debugger gets out of the recursive edit and kills the backtrace -buffer. +the debugger gets out of the recursive edit and buries the backtrace +buffer. (You can customize what the @kbd{q} command does with the +backtrace buffer by setting the variable @code{debugger-bury-or-kill}. +For example, set it to @code{kill} if you prefer to kill the buffer +rather than bury it. Consult the variable's documentation for more +possibilities.) When the debugger has been entered, the @code{debug-on-error} variable is temporarily set according to diff --git a/etc/NEWS b/etc/NEWS index 42c639ef25b..26707315da6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -804,7 +804,9 @@ table, but with a different prefix. *** New error type and new function `user-error'. These do not trigger the debugger. -*** New option `debugger-bury-or-kill'. ++++ +*** New option `debugger-bury-or-kill', saying what to do with the +debugger buffer when exiting debug. +++ *** Set `debug-on-message' to enter the debugger when a certain diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0207a4f903f..d7f86f510c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-11-11 Glenn Morris + * emacs-lisp/debug.el (debugger-bury-or-kill): Doc tweak. + * help.el (temp-buffer-max-height): * window.el (fit-frame-to-buffer, fit-frame-to-buffer-bottom-margin): * emacs-lisp/debug.el (debugger-bury-or-kill): Fix :version. diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 1117d11e07e..6be30fc9164 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -49,9 +49,9 @@ the middle is discarded, and just the beginning and end are displayed." :version "21.1") (defcustom debugger-bury-or-kill 'bury - "How to proceed with the debugger buffer when exiting `debug'. -The value used here affects the behavior of operations on any -window previously showing the debugger buffer. + "What to do with the debugger buffer when exiting `debug'. +The value affects the behavior of operations on any window +previously showing the debugger buffer. `nil' means that if its window is not deleted when exiting the debugger, invoking `switch-to-prev-buffer' will usually show From 38785e75a29b546512ec58fd96b1946b4b98417c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 17:47:56 -0800 Subject: [PATCH 08/23] * lisp/window.el (with-temp-buffer-window): Doc tweak. --- lisp/ChangeLog | 2 ++ lisp/window.el | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7f86f510c5..d89b0b19359 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-11-11 Glenn Morris + * window.el (with-temp-buffer-window): Doc tweak. + * emacs-lisp/debug.el (debugger-bury-or-kill): Doc tweak. * help.el (temp-buffer-max-height): diff --git a/lisp/window.el b/lisp/window.el index b3a66ca1dd3..30ee622cfe6 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -143,37 +143,36 @@ to `display-buffer'." window)))) (defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body) - "Evaluate BODY and display buffer specified by BUFFER-OR-NAME. -BUFFER-OR-NAME must specify either a live buffer or the name of a -buffer. If no buffer with such a name exists, create one. + "Evaluate BODY and display the buffer specified by BUFFER-OR-NAME. +BUFFER-OR-NAME must specify either a live buffer, or the name of a +buffer (if it does not exist, this macro creates it). Make sure the specified buffer is empty before evaluating BODY. Do not make that buffer current for BODY. Instead, bind `standard-output' to that buffer, so that output generated with `prin1' and similar functions in BODY goes into that buffer. -After evaluating BODY, mark the specified buffer unmodified and -read-only, and display it in a window via `display-buffer'. Pass -ACTION as action argument to `display-buffer'. Automatically -shrink the window used if `temp-buffer-resize-mode' is enabled. +After evaluating BODY, this marks the specified buffer unmodified and +read-only, and displays it in a window via `display-buffer', passing +ACTION as the action argument to `display-buffer'. It automatically +shrinks the relevant window if `temp-buffer-resize-mode' is enabled. -Return the value returned by BODY unless QUIT-FUNCTION specifies -a function. In that case, run the function with two arguments - +Returns the value returned by BODY, unless QUIT-FUNCTION specifies +a function. In that case, runs the function with two arguments - the window showing the specified buffer and the value returned by -BODY - and return the value returned by that function. +BODY - and returns the value returned by that function. If the buffer is displayed on a new frame, the window manager may decide to select that frame. In that case, it's usually a good strategy if the function specified by QUIT-FUNCTION selects the window showing the buffer before reading a value from the -minibuffer, for example, when asking a `yes-or-no-p' question. +minibuffer; for example, when asking a `yes-or-no-p' question. -This construct is similar to `with-output-to-temp-buffer' but -does neither put the buffer in help mode nor does it call -`temp-buffer-show-function'. It also runs different hooks, -namely `temp-buffer-window-setup-hook' (with the specified buffer -current) and `temp-buffer-window-show-hook' (with the specified -buffer current and the window showing it selected). +This construct is similar to `with-output-to-temp-buffer', but does +not put the buffer in help mode, or call `temp-buffer-show-function'. +It also runs different hooks, namely `temp-buffer-window-setup-hook' +\(with the specified buffer current) and `temp-buffer-window-show-hook' +\(with the specified buffer current and the window showing it selected). Since this macro calls `display-buffer', the window displaying the buffer is usually not selected and the specified buffer From 8f2cb64f11dd60f2a6933de877025a9a9e405a06 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 18:03:45 -0800 Subject: [PATCH 09/23] NEWS markup --- etc/NEWS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 26707315da6..ae2b5adf85d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -131,6 +131,7 @@ next and previous path separator, respectively. *** minibuffer-electric-default-mode can rewrite (default ...) to [...]. Just set minibuffer-eldef-shorten-default to t before enabling the mode. ++++ ** ImageMagick support, if available, is automatically enabled. It is no longer necessary to call `imagemagick-register-types' explicitly to install ImageMagick image types; that function is called @@ -873,7 +874,7 @@ in Emacs 24.1: *** `current-time-string' no longer requires that its argument's year must be in the range 1000..9999. It now works with any year supported by the underlying C implementation. - ++++ *** `current-time' now returns extended-format time stamps (HIGH LOW USEC PSEC), where the new PSEC slot specifies picoseconds. PSEC is typically a multiple of 1000 on current machines. Other @@ -885,7 +886,7 @@ stamps are still accepted. [TRIGGERED-P HI-SECS LO-SECS USECS REPEAT-DELAY FUNCTION ARGS IDLE-DELAY PSECS]. The PSECS slot is new, and uses picosecond resolution. It can be accessed via the new timer--psecs accessor. - ++++ *** Last-modified time stamps in undo lists now are of the form (t HI-SECS LO-SECS USECS PSECS) instead of (t HI-SECS . LO-SECS). From 49d0466926552f3f349573ea46e34941f71d07bc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 18:12:56 -0800 Subject: [PATCH 10/23] NEWS markup --- etc/NEWS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index ae2b5adf85d..97e4f53620a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -448,8 +448,9 @@ See `flymake-fringe-indicator-position', `flymake-error-bitmap' and ** Follow mode no longer works by using advice. The option `follow-intercept-processes' has been removed. +--- ** The FFAP option `ffap-url-unwrap-remote' can now be a list of strings, -specifying URL types which should be converted to remote file names at +specifying URL types that should be converted to remote file names at the FFAP prompt. The default is now '("ftp"). ** New Ibuffer `derived-mode' filter, bound to `/ M'. @@ -467,11 +468,14 @@ The old binding for `/ M' (filter by used-mode) is now bound to `/ m'. The function `notifications-get-capabilities' returns the supported server properties. +--- ** In Perl mode, new option `perl-indent-parens-as-block' causes non-block closing brackets to be aligned with the line of the opening bracket. +--- ** In Proced mode, new command `proced-renice' renices marked processes. +--- ** Python mode A new version of python.el, which provides several new features, including: From 84acf328502d00e789b0d5777df955337cbb1dbf Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 18:18:14 -0800 Subject: [PATCH 11/23] Fix ibuffer menu typo * lisp/ibuffer.el (ibuffer-mode-map): Don't have two menu items with the same name shadowing each other. --- lisp/ChangeLog | 3 +++ lisp/ibuffer.el | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d89b0b19359..5551828c847 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-11-11 Glenn Morris + * ibuffer.el (ibuffer-mode-map): Don't have two menu items with + the same name shadowing each other. + * window.el (with-temp-buffer-window): Doc tweak. * emacs-lisp/debug.el (debugger-bury-or-kill): Doc tweak. diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index c9dcff41618..e5d9910a186 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -632,9 +632,9 @@ directory, like `default-directory'." '(menu-item "Disable all filtering" ibuffer-filter-disable :enable (and (featurep 'ibuf-ext) ibuffer-filtering-qualifiers))) (define-key-after map [menu-bar view filter filter-by-mode] - '(menu-item "Add filter by major mode..." ibuffer-filter-by-mode)) - (define-key-after map [menu-bar view filter filter-by-mode] - '(menu-item "Add filter by major mode in use..." + '(menu-item "Add filter by any major mode..." ibuffer-filter-by-mode)) + (define-key-after map [menu-bar view filter filter-by-used-mode] + '(menu-item "Add filter by a major mode in use..." ibuffer-filter-by-used-mode)) (define-key-after map [menu-bar view filter filter-by-name] '(menu-item "Add filter by buffer name..." ibuffer-filter-by-name)) From a1d3e07e2896faadfd56b35a8c5f775353f39058 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 10 Nov 2012 18:22:26 -0800 Subject: [PATCH 12/23] Add ibuffer-filter-by-derived-mode to ibuffer menu and doc * lisp/ibuffer.el (ibuffer-mode-map, ibuffer-mode): Add ibuffer-filter-by-derived-mode. * etc/NEWS: Related markup. --- etc/NEWS | 1 + lisp/ChangeLog | 3 +++ lisp/ibuffer.el | 8 ++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 97e4f53620a..16feea02eaf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -453,6 +453,7 @@ The option `follow-intercept-processes' has been removed. specifying URL types that should be converted to remote file names at the FFAP prompt. The default is now '("ftp"). +--- ** New Ibuffer `derived-mode' filter, bound to `/ M'. The old binding for `/ M' (filter by used-mode) is now bound to `/ m'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5551828c847..8228d857233 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2012-11-11 Glenn Morris + * ibuffer.el (ibuffer-mode-map, ibuffer-mode): + Add ibuffer-filter-by-derived-mode. + * ibuffer.el (ibuffer-mode-map): Don't have two menu items with the same name shadowing each other. diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index e5d9910a186..72ca189e9d5 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -636,6 +636,9 @@ directory, like `default-directory'." (define-key-after map [menu-bar view filter filter-by-used-mode] '(menu-item "Add filter by a major mode in use..." ibuffer-filter-by-used-mode)) + (define-key-after map [menu-bar view filter filter-by-derived-mode] + '(menu-item "Add filter by derived mode..." + ibuffer-filter-by-derived-mode)) (define-key-after map [menu-bar view filter filter-by-name] '(menu-item "Add filter by buffer name..." ibuffer-filter-by-name)) (define-key-after map [menu-bar view filter filter-by-filename] @@ -2438,8 +2441,9 @@ Marking commands: Filtering commands: - '\\[ibuffer-filter-by-mode]' - Add a filter by major mode. - '\\[ibuffer-filter-by-used-mode]' - Add a filter by major mode now in use. + '\\[ibuffer-filter-by-mode]' - Add a filter by any major mode. + '\\[ibuffer-filter-by-used-mode]' - Add a filter by a major mode now in use. + '\\[ibuffer-filter-by-derived-mode]' - Add a filter by derived mode. '\\[ibuffer-filter-by-name]' - Add a filter by buffer name. '\\[ibuffer-filter-by-content]' - Add a filter by buffer content. '\\[ibuffer-filter-by-filename]' - Add a filter by filename. From d1e1e53dec51a9cb8aa9d6033d32428051ab7e85 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 12 Nov 2012 05:11:06 +0400 Subject: [PATCH 13/23] * lisp/progmodes/ruby-mode.el (ruby-move-to-block): When moving backward, always stop at indentation. Reverts the change from 2012-08-12T22:06:56Z!monnier@iro.umontreal.ca. Fixes: debbugs:12851 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/ruby-mode.el | 12 +----------- test/automated/ruby-mode-tests.el | 4 ++-- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8228d857233..bfd74a15a8a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-11-12 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-move-to-block): When moving + backward, always stop at indentation. Reverts the change from + 2012-08-12T22:06:56Z!monnier@iro.umontreal.ca (Bug#12851). + 2012-11-11 Glenn Morris * ibuffer.el (ibuffer-mode-map, ibuffer-mode): diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 84cf7308d75..e4bfffa73c1 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -898,17 +898,7 @@ or blocks containing the current block." (back-to-indentation) (if (looking-at (concat "\\<\\(" ruby-block-mid-re "\\)\\>")) (setq done nil))))) - (back-to-indentation) - (when (< n 0) - (let ((eol (point-at-eol)) state next) - (if (< orig eol) (setq eol orig)) - (setq orig (point)) - (while (and (setq next (apply 'ruby-parse-partial eol state)) - (< (point) eol)) - (setq state next)) - (when (cdaadr state) - (goto-char (cdaadr state))) - (backward-word))))) + (back-to-indentation))) (defun ruby-beginning-of-block (&optional arg) "Move backward to the beginning of the current block. diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index ba3040577b1..8da0041e9a4 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -202,13 +202,13 @@ VALUES-PLIST is a list with alternating index and value elements." | end |")) -(ert-deftest ruby-move-to-block-stops-at-opening () +(ert-deftest ruby-move-to-block-stops-at-indentation () (with-temp-buffer (insert "def f\nend") (beginning-of-line) (ruby-mode) (ruby-move-to-block -1) - (should (looking-at "f$")))) + (should (looking-at "^def")))) (ert-deftest ruby-toggle-block-to-do-end () (with-temp-buffer From adad6d8f2769e32cbbe9fe785cfef021b48cd140 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 12 Nov 2012 00:18:38 -0800 Subject: [PATCH 14/23] * doc/emacs/misc.texi (Single Shell): Mention async-shell-command-buffer. * etc/NEWS: Related markup. --- doc/emacs/ChangeLog | 4 ++++ doc/emacs/misc.texi | 10 +++++++++- etc/NEWS | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 9390daef38d..4591cfb99fe 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2012-11-12 Glenn Morris + + * misc.texi (Single Shell): Mention async-shell-command-buffer. + 2012-11-10 Glenn Morris * misc.texi (Terminal emulator): Rename `term-face' to `term'. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 244920a23ae..1836c1982e6 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -542,11 +542,19 @@ which is impossible to ignore. You can also type @kbd{M-&} (@code{async-shell-command}) to execute a shell command asynchronously; this is exactly like calling @kbd{M-!} with a trailing @samp{&}, except that you do not need the @samp{&}. -The output buffer for asynchronous shell commands is named +The default output buffer for asynchronous shell commands is named @samp{*Async Shell Command*}. Emacs inserts the output into this buffer as it comes in, whether or not the buffer is visible in a window. +@vindex async-shell-command-buffer + If you want to run more than one asynchronous shell command at the +same time, they could end up competing for the output buffer. The +option @code{async-shell-command-buffer} specifies what to do about +this; e.g., whether to rename the pre-existing output buffer, or to +use a different buffer for the new command. Consult the variable's +documentation for more possibilities. + @kindex M-| @findex shell-command-on-region @kbd{M-|} (@code{shell-command-on-region}) is like @kbd{M-!}, but diff --git a/etc/NEWS b/etc/NEWS index 16feea02eaf..d57e96eb566 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -561,8 +561,9 @@ Sphinx support has been improved. *** `sh-use-smie' lets you choose a new indentation and navigation code. ++++ ** New option `async-shell-command-buffer' specifies the buffer to use -for a new asynchronous shell command when the default output buffer +for a new asynchronous `shell-command' when the default output buffer `*Async Shell Command*' is already in use. --- From a13e12f95726b8a99fc94412ad3f16b88bbd18ad Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 12 Nov 2012 00:23:23 -0800 Subject: [PATCH 15/23] Mention a few more gv.el features in the lispref * doc/lispref/variables.texi (Adding Generalized Variables): At least mention gv-define-expander and gv-letplace. --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/variables.texi | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 9d101722388..eabfc6e9c78 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2012-11-12 Glenn Morris + + * variables.texi (Adding Generalized Variables): + At least mention gv-define-expander and gv-letplace. + 2012-11-11 Glenn Morris * debugging.texi (Error Debugging): Mention debug-on-message. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 814c5e2dd1c..dfde3c45c04 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2133,12 +2133,14 @@ set. An example of using this macro is: @end example @end defmac -@c FIXME? Not sure what, if anything, to say about this. -@ignore -@defmac gv-define-expander name handler -This is the most general way to define a new @code{setf} expansion. -@end defmac -@end ignore +@findex gv-define-expander +@findex gv-letplace +@c FIXME? Not sure what or how much to say about these. +@c See cl.texi for an example of using gv-letplace. +For more control over the expansion, see the macro @code{gv-define-expander}. +The macro @code{gv-letplace} can be useful in defining macros that +perform similarly to @code{setf}; for example, the @code{incf} macro +of Common Lisp. Consult the source file @file{gv.el} for more details. @cindex CL note---no @code{setf} functions @quotation From 24c38527d134951d3cfe8e3adae0b723061920d5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 12 Nov 2012 00:42:27 -0800 Subject: [PATCH 16/23] Document flymake fringe bitmaps * doc/misc/flymake.texi (Customizable variables) (Highlighting erroneous lines): Mention flymake-error-bitmap, flymake-warning-bitmap, and flymake-fringe-indicator-position. * lisp/progmodes/flymake.el (flymake-error-bitmap) (flymake-warning-bitmap, flymake-fringe-indicator-position): Doc fixes. (flymake-error-bitmap, flymake-warning-bitmap): Fix :types. * etc/NEWS: Related markup. --- doc/misc/ChangeLog | 6 ++++++ doc/misc/flymake.texi | 20 ++++++++++++++++++++ etc/NEWS | 1 + lisp/ChangeLog | 6 ++++++ lisp/progmodes/flymake.el | 30 ++++++++++++++++++++++-------- 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 80d19f3adaa..b3b4ad07147 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,9 @@ +2012-11-12 Glenn Morris + + * flymake.texi (Customizable variables) + (Highlighting erroneous lines): Mention flymake-error-bitmap, + flymake-warning-bitmap, and flymake-fringe-indicator-position. + 2012-11-09 Chong Yidong * url.texi (Introduction): Move url-configuration-directory to diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 28fb7864f06..4a873490e86 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -337,6 +337,17 @@ been reported. A custom face for highlighting lines for which at least one warning and no errors have been reported. +@item flymake-error-bitmap +A bitmap used in the fringe to mark lines for which an error has +been reported. + +@item flymake-warning-bitmap +A bitmap used in the fringe to mark lines for which a warning has +been reported. + +@item flymake-fringe-indicator-position +Which fringe (if any) should show the warning/error bitmaps. + @end table @node Adding support for a new syntax check tool @@ -718,6 +729,15 @@ are used: @code{flymake-errline} and @code{flymake-warnline}. Errors belonging outside the current buffer are considered to belong to line 1 of the current buffer. +@c This manual does not use vindex. +@c @vindex flymake-fringe-indicator-position +@c @vindex flymake-error-bitmap +@c @vindex flymake-warning-bitmap +If the option @code{flymake-fringe-indicator-position} is non-@code{nil}, +errors and warnings are also highlighted in the left or right fringe, +using the bitmaps specified by @code{flymake-error-bitmap} +and @code{flymake-warning-bitmap}. + @node Interaction with other modes @section Interaction with other modes @cindex Interaction with other modes diff --git a/etc/NEWS b/etc/NEWS index d57e96eb566..6913909c6a8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -440,6 +440,7 @@ when you receive a private message or your nickname is mentioned. *** ERC will look up server/channel names via auth-source and use any channel keys found. ++++ ** Flymake uses fringe bitmaps to indicate errors and warnings. See `flymake-fringe-indicator-position', `flymake-error-bitmap' and `flymake-warning-bitmap'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bfd74a15a8a..9a01f2be20f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-11-12 Glenn Morris + + * progmodes/flymake.el (flymake-error-bitmap) + (flymake-warning-bitmap, flymake-fringe-indicator-position): Doc fixes. + (flymake-error-bitmap, flymake-warning-bitmap): Fix :types. + 2012-11-12 Dmitry Gutov * progmodes/ruby-mode.el (ruby-move-to-block): When moving diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 2614af9ffa4..5ba84f8991e 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -764,25 +764,39 @@ line number outside the file being compiled." (and (overlayp ov) (overlay-get ov 'flymake-overlay))) (defcustom flymake-error-bitmap '(exclamation-mark error) - "Bitmap used in the fringe for indicating errors. + "Bitmap (a symbol) used in the fringe for indicating errors. The value may also be a list of two elements where the second -element specifies the face for the bitmap." +element specifies the face for the bitmap. For possible bitmap +symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'. + +The option `flymake-fringe-indicator-position' controls how and where +this is used." :group 'flymake :version "24.3" - :type 'symbol) + :type '(choice (symbol :tag "Bitmap") + (list :tag "Bitmap and face" + (symbol :tag "Bitmap") + (face :tag "Face")))) (defcustom flymake-warning-bitmap 'question-mark - "Bitmap used in the fringe for indicating warnings. + "Bitmap (a symbol) used in the fringe for indicating warnings. The value may also be a list of two elements where the second -element specifies the face for the bitmap." +element specifies the face for the bitmap. For possible bitmap +symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'. + +The option `flymake-fringe-indicator-position' controls how and where +this is used." :group 'flymake :version "24.3" - :type 'symbol) + :type '(choice (symbol :tag "Bitmap") + (list :tag "Bitmap and face" + (symbol :tag "Bitmap") + (face :tag "Face")))) (defcustom flymake-fringe-indicator-position 'left-fringe "The position to put flymake fringe indicator. -The value can be nil, left-fringe or right-fringe. -Fringe indicators are disabled if nil." +The value can be nil (do not use indicators), `left-fringe' or `right-fringe'. +See `flymake-error-bitmap' and `flymake-warning-bitmap'." :group 'flymake :version "24.3" :type '(choice (const left-fringe) From 2e6625b527f5ad134e28af5c2eba0349c640c942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Mon, 12 Nov 2012 10:26:50 -0300 Subject: [PATCH 17/23] Fix end-of-defun misbehavior. * progmodes/python.el (python-nav-beginning-of-defun): Rename from python-beginning-of-defun-function. Handle nested defuns correctly. (python-nav-end-of-defun): Rename from python-end-of-defun-function. Ensure forward movement. (python-info-current-defun): Reimplemented to work as intended with new fixed python-nav-{end,beginning}-of-defun. Stop scanning parent defuns as soon as possible. --- lisp/ChangeLog | 12 ++++ lisp/progmodes/python.el | 137 ++++++++++++++++++++------------------- 2 files changed, 81 insertions(+), 68 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9a01f2be20f..86bae4ec777 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2012-11-12 Fabián Ezequiel Gallina + + Fix end-of-defun misbehavior. + * progmodes/python.el (python-nav-beginning-of-defun): Rename from + python-beginning-of-defun-function. Handle nested defuns + correctly. + (python-nav-end-of-defun): Rename from + python-end-of-defun-function. Ensure forward movement. + (python-info-current-defun): Reimplemented to work as intended + with new fixed python-nav-{end,beginning}-of-defun. Stop scanning + parent defuns as soon as possible. + 2012-11-12 Glenn Morris * progmodes/flymake.el (flymake-error-bitmap) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ee98feaef5e..949b0252bf1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1074,12 +1074,9 @@ automatically if needed." The name of the defun should be grouped so it can be retrieved via `match-string'.") -(defun python-nav-beginning-of-defun (&optional arg) - "Move point to `beginning-of-defun'. -With positive ARG move search backwards. With negative do the -same but forward. When ARG is nil or 0 defaults to 1. This is -the main part of `python-beginning-of-defun-function'. Return -non-nil if point is moved to `beginning-of-defun'." +(defun python-nav--beginning-of-defun (&optional arg) + "Internal implementation of `python-nav-beginning-of-defun'. +With positive ARG search backwards, else search forwards." (when (or (null arg) (= arg 0)) (setq arg 1)) (let* ((re-search-fn (if (> arg 0) #'re-search-backward @@ -1087,6 +1084,15 @@ non-nil if point is moved to `beginning-of-defun'." (line-beg-pos (line-beginning-position)) (line-content-start (+ line-beg-pos (current-indentation))) (pos (point-marker)) + (beg-indentation + (and (> arg 0) + (save-excursion + (and (python-info-current-line-empty-p) + (python-util-forward-comment -1)) + (python-nav-beginning-of-statement) + (if (python-info-looking-at-beginning-of-defun) + (+ (current-indentation) python-indent-offset) + (current-indentation))))) (found (progn (when (and (< arg 0) @@ -1094,7 +1100,12 @@ non-nil if point is moved to `beginning-of-defun'." (end-of-line 1)) (while (and (funcall re-search-fn python-nav-beginning-of-defun-regexp nil t) - (python-syntax-context-type))) + (or (python-syntax-context-type) + ;; Handle nested defuns when moving + ;; backwards by checking indentation. + (and (> arg 0) + (not (= (current-indentation) 0)) + (>= (current-indentation) beg-indentation))))) (and (python-info-looking-at-beginning-of-defun) (or (not (= (line-number-at-pos pos) (line-number-at-pos))) @@ -1105,55 +1116,43 @@ non-nil if point is moved to `beginning-of-defun'." (or (beginning-of-line 1) t) (and (goto-char pos) nil)))) -(defun python-beginning-of-defun-function (&optional arg) - "Move point to the beginning of def or class. -With positive ARG move that number of functions backwards. With -negative do the same but forward. When ARG is nil or 0 defaults -to 1. Return non-nil if point is moved to `beginning-of-defun'." +(defun python-nav-beginning-of-defun (&optional arg) + "Move point to `beginning-of-defun'. +With positive ARG search backwards else search forward. When ARG +is nil or 0 defaults to 1. When searching backwards nested +defuns are handled with care depending on current point +position. Return non-nil if point is moved to +`beginning-of-defun'." (when (or (null arg) (= arg 0)) (setq arg 1)) (let ((found)) (cond ((and (eq this-command 'mark-defun) (python-info-looking-at-beginning-of-defun))) (t (dotimes (i (if (> arg 0) arg (- arg))) - (when (and (python-nav-beginning-of-defun arg) + (when (and (python-nav--beginning-of-defun arg) (not found)) (setq found t))))) found)) -(defun python-end-of-defun-function () +(defun python-nav-end-of-defun () "Move point to the end of def or class. Returns nil if point is not in a def or class." (interactive) - (let ((beg-defun-indent)) + (let ((beg-defun-indent) + (beg-pos (point))) (when (or (python-info-looking-at-beginning-of-defun) - (python-beginning-of-defun-function 1) - (python-beginning-of-defun-function -1)) + (python-nav-beginning-of-defun 1) + (python-nav-beginning-of-defun -1)) (setq beg-defun-indent (current-indentation)) + (while (progn + (python-nav-end-of-statement) + (python-util-forward-comment 1) + (and (> (current-indentation) beg-defun-indent) + (not (eobp))))) + (python-util-forward-comment -1) (forward-line 1) - ;; Go as forward as possible - (while (and (or - (python-nav-beginning-of-defun -1) - (and (goto-char (point-max)) nil)) - (> (current-indentation) beg-defun-indent))) - (beginning-of-line 1) - ;; Go as backwards as possible - (while (and (forward-line -1) - (not (bobp)) - (or (not (current-word)) - (equal (char-after (+ (point) (current-indentation))) ?#) - (<= (current-indentation) beg-defun-indent) - (looking-at (python-rx decorator)) - (python-syntax-context-type)))) - (forward-line 1) - ;; If point falls inside a paren or string context the point is - ;; forwarded at the end of it (or end of buffer if its not closed) - (let ((context-type (python-syntax-context-type))) - (when (memq context-type '(paren string)) - ;; Slow but safe. - (while (and (not (eobp)) - (python-syntax-context-type)) - (forward-line 1))))))) + ;; Ensure point moves forward. + (and (> beg-pos (point)) (goto-char beg-pos))))) (defun python-nav-beginning-of-statement () "Move to start of current statement." @@ -2022,7 +2021,7 @@ When argument ARG is non-nil do not include decorators." (python-shell-send-region (progn (end-of-line 1) - (while (and (or (python-beginning-of-defun-function) + (while (and (or (python-nav-beginning-of-defun) (beginning-of-line 1)) (> (current-indentation) 0))) (when (not arg) @@ -2031,7 +2030,7 @@ When argument ARG is non-nil do not include decorators." (forward-line 1)) (point-marker)) (progn - (or (python-end-of-defun-function) + (or (python-nav-end-of-defun) (end-of-line 1)) (point-marker))))) @@ -2879,38 +2878,40 @@ Optional argument INCLUDE-TYPE indicates to include the type of the defun. This function is compatible to be used as `add-log-current-defun-function' since it returns nil if point is not inside a defun." - (let ((names '()) - (starting-indentation) - (starting-point) - (first-run t)) (save-restriction (widen) (save-excursion - (setq starting-point (point-marker)) - (setq starting-indentation (save-excursion - (python-nav-beginning-of-statement) - (current-indentation))) (end-of-line 1) - (while (python-beginning-of-defun-function 1) - (when (or (< (current-indentation) starting-indentation) - (and first-run - (< - starting-point - (save-excursion - (python-end-of-defun-function) - (point-marker))))) - (setq first-run nil) - (setq starting-indentation (current-indentation)) - (looking-at python-nav-beginning-of-defun-regexp) - (setq names (cons + (let ((names) + (starting-indentation + (save-excursion + (and + (python-nav-beginning-of-defun 1) + ;; This extra number is just for checking code + ;; against indentation to work well on first run. + (+ (current-indentation) 4)))) + (starting-point (point))) + ;; Check point is inside a defun. + (when (and starting-indentation + (< starting-point + (save-excursion + (python-nav-end-of-defun) + (point)))) + (catch 'exit + (while (python-nav-beginning-of-defun 1) + (when (< (current-indentation) starting-indentation) + (setq starting-indentation (current-indentation)) + (setq names + (cons (if (not include-type) (match-string-no-properties 1) (mapconcat 'identity (split-string (match-string-no-properties 0)) " ")) - names)))))) - (when names - (mapconcat (lambda (string) string) names ".")))) + names))) + (and (= (current-indentation) 0) (throw 'exit t))))) + (and names + (mapconcat (lambda (string) string) names ".")))))) (defun python-info-current-symbol (&optional replace-self) "Return current symbol using dotty syntax. @@ -3200,9 +3201,9 @@ if that value is non-nil." 'python-fill-paragraph) (set (make-local-variable 'beginning-of-defun-function) - #'python-beginning-of-defun-function) + #'python-nav-beginning-of-defun) (set (make-local-variable 'end-of-defun-function) - #'python-end-of-defun-function) + #'python-nav-end-of-defun) (add-hook 'completion-at-point-functions 'python-completion-complete-at-point nil 'local) @@ -3230,7 +3231,7 @@ if that value is non-nil." (add-to-list 'hs-special-modes-alist `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" ,(lambda (arg) - (python-end-of-defun-function)) nil)) + (python-nav-end-of-defun)) nil)) (set (make-local-variable 'mode-require-final-newline) t) From 325202732506c35fec0a7bd772d218eaf0ac659f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 12 Nov 2012 17:25:34 +0200 Subject: [PATCH 18/23] Fix bug #12867 with crashes due to large field width in mode-line format. src/xdisp.c (decode_mode_spec): Limit the value of WIDTH argument passed to pint2str and pint2hrstr to be at most the size of the frame's decode_mode_spec_buffer. This avoids crashes with very large values of FIELD_WIDTH argument to decode_mode_spec. --- src/ChangeLog | 8 ++++++++ src/xdisp.c | 16 +++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9e0f92f557e..494b2179516 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-11-12 Eli Zaretskii + + * xdisp.c (decode_mode_spec): Limit the value of WIDTH argument + passed to pint2str and pint2hrstr to be at most the size of the + frame's decode_mode_spec_buffer. This avoids crashes with very + large values of FIELD_WIDTH argument to decode_mode_spec. + (Bug#12867) + 2012-11-07 Martin Rudalics * window.c (Fsplit_window_internal): Set combination limit of diff --git a/src/xdisp.c b/src/xdisp.c index c7195504c4c..290c3a07fe9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21380,6 +21380,12 @@ decode_mode_spec (struct window *w, register int c, int field_width, Lisp_Object obj; struct frame *f = XFRAME (WINDOW_FRAME (w)); char *decode_mode_spec_buf = f->decode_mode_spec_buffer; + /* We are going to use f->decode_mode_spec_buffer as the buffer to + produce strings from numerical values, so limit preposterously + large values of FIELD_WIDTH to avoid overrunning the buffer's + end. The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE + bytes plus the terminating null. */ + int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f)); struct buffer *b = current_buffer; obj = Qnil; @@ -21475,7 +21481,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, { ptrdiff_t col = current_column (); wset_column_number_displayed (w, make_number (col)); - pint2str (decode_mode_spec_buf, field_width, col); + pint2str (decode_mode_spec_buf, width, col); return decode_mode_spec_buf; } @@ -21506,14 +21512,14 @@ decode_mode_spec (struct window *w, register int c, int field_width, case 'i': { ptrdiff_t size = ZV - BEGV; - pint2str (decode_mode_spec_buf, field_width, size); + pint2str (decode_mode_spec_buf, width, size); return decode_mode_spec_buf; } case 'I': { ptrdiff_t size = ZV - BEGV; - pint2hrstr (decode_mode_spec_buf, field_width, size); + pint2hrstr (decode_mode_spec_buf, width, size); return decode_mode_spec_buf; } @@ -21620,12 +21626,12 @@ decode_mode_spec (struct window *w, register int c, int field_width, line_number_displayed = 1; /* Make the string to show. */ - pint2str (decode_mode_spec_buf, field_width, topline + nlines); + pint2str (decode_mode_spec_buf, width, topline + nlines); return decode_mode_spec_buf; no_value: { char* p = decode_mode_spec_buf; - int pad = field_width - 2; + int pad = width - 2; while (pad-- > 0) *p++ = ' '; *p++ = '?'; From 237b5653575e868f67ca8616f9c9c2c464cfbdd1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 12 Nov 2012 11:50:08 -0500 Subject: [PATCH 19/23] * lisp/cedet/semantic/mru-bookmark.el (semantic-mru-bookmark-mode): * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): * lisp/cedet/semantic/util-modes.el (semantic-highlight-edits-mode) (semantic-show-parser-state-mode): Avoid obsolete name semantic-edits-new-change-hooks. Fixes: debbugs:12869 --- lisp/cedet/ChangeLog | 16 ++++++++++++---- lisp/cedet/semantic/grammar.el | 4 ++-- lisp/cedet/semantic/mru-bookmark.el | 6 +++--- lisp/cedet/semantic/util-modes.el | 12 ++++++------ 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 55fce80e18b..6de901848c7 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,11 @@ +2012-11-12 Stefan Monnier + + * semantic/mru-bookmark.el (semantic-mru-bookmark-mode): + * semantic/grammar.el (semantic-grammar-mode): + * semantic/util-modes.el (semantic-highlight-edits-mode) + (semantic-show-parser-state-mode): Avoid obsolete name + semantic-edits-new-change-hooks (bug#12869). + 2012-11-10 Glenn Morris * srecode/srt-mode.el (srecode-template-mode): @@ -5,8 +13,8 @@ 2012-10-25 David Engster - * semantic/analyze.el (semantic-analyze-dereference-alias): New - function to dereference aliases. + * semantic/analyze.el (semantic-analyze-dereference-alias): + New function to dereference aliases. (semantic-analyze-current-context-default): Use it. * semantic/grammar.el (semantic-grammar-create-package): @@ -17,8 +25,8 @@ * semantic.el (semantic-elapsed-time): Make it a defsubst. - * srecode/dictionary.el (srecode-adebug-dictionary): Remove - require for `semantic'. + * srecode/dictionary.el (srecode-adebug-dictionary): + Remove require for `semantic'. * srecode/map.el: * srecode/insert.el: Declare functions from `data-debug'. diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index c0e7b8f9038..8535c067e09 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1333,8 +1333,8 @@ the change bounds to encompass the whole nonterminal tag." (add-hook 'before-change-functions 'semantic--grammar-clear-macros-regexp-2 nil t) ;; Handle safe re-parse of grammar rules. - (semantic-make-local-hook 'semantic-edits-new-change-hooks) - (add-hook 'semantic-edits-new-change-hooks + (semantic-make-local-hook 'semantic-edits-new-change-functions) + (add-hook 'semantic-edits-new-change-functions 'semantic-grammar-edits-new-change-hook-fcn nil t) (semantic-run-mode-hooks 'semantic-grammar-mode-hook)) diff --git a/lisp/cedet/semantic/mru-bookmark.el b/lisp/cedet/semantic/mru-bookmark.el index d042ba42582..1358fc7d062 100644 --- a/lisp/cedet/semantic/mru-bookmark.el +++ b/lisp/cedet/semantic/mru-bookmark.el @@ -292,13 +292,13 @@ minor mode is enabled." (setq semantic-mru-bookmark-mode nil) (error "Buffer %s was not set up for parsing" (buffer-name))) - (semantic-make-local-hook 'semantic-edits-new-change-hooks) - (add-hook 'semantic-edits-new-change-hooks + (semantic-make-local-hook 'semantic-edits-new-change-functions) + (add-hook 'semantic-edits-new-change-functions 'semantic-mru-bookmark-change-hook-fcn nil t) (add-hook 'semantic-edits-move-change-hooks 'semantic-mru-bookmark-change-hook-fcn nil t)) ;; Remove hooks - (remove-hook 'semantic-edits-new-change-hooks + (remove-hook 'semantic-edits-new-change-functions 'semantic-mru-bookmark-change-hook-fcn t) (remove-hook 'semantic-edits-move-change-hooks 'semantic-mru-bookmark-change-hook-fcn t))) diff --git a/lisp/cedet/semantic/util-modes.el b/lisp/cedet/semantic/util-modes.el index c9a0faefe6c..744d37ff189 100644 --- a/lisp/cedet/semantic/util-modes.el +++ b/lisp/cedet/semantic/util-modes.el @@ -221,11 +221,11 @@ minor mode is enabled." (setq semantic-highlight-edits-mode nil) (error "Buffer %s was not set up for parsing" (buffer-name))) - (semantic-make-local-hook 'semantic-edits-new-change-hooks) - (add-hook 'semantic-edits-new-change-hooks + (semantic-make-local-hook 'semantic-edits-new-change-functions) + (add-hook 'semantic-edits-new-change-functions 'semantic-highlight-edits-new-change-hook-fcn nil t)) ;; Remove hooks - (remove-hook 'semantic-edits-new-change-hooks + (remove-hook 'semantic-edits-new-change-functions 'semantic-highlight-edits-new-change-hook-fcn t))) (semantic-add-minor-mode 'semantic-highlight-edits-mode @@ -460,8 +460,8 @@ minor mode is enabled." (append mode-line-modified '(semantic-show-parser-state-string)))) ;; Add hooks - (semantic-make-local-hook 'semantic-edits-new-change-hooks) - (add-hook 'semantic-edits-new-change-hooks + (semantic-make-local-hook 'semantic-edits-new-change-functions) + (add-hook 'semantic-edits-new-change-functions 'semantic-show-parser-state-marker nil t) (semantic-make-local-hook 'semantic-edits-incremental-reparse-failed-hook) (add-hook 'semantic-edits-incremental-reparse-failed-hook @@ -491,7 +491,7 @@ minor mode is enabled." (setq mode-line-modified (delq 'semantic-show-parser-state-string mode-line-modified)) ;; Remove hooks - (remove-hook 'semantic-edits-new-change-hooks + (remove-hook 'semantic-edits-new-change-functions 'semantic-show-parser-state-marker t) (remove-hook 'semantic-edits-incremental-reparse-failed-hook 'semantic-show-parser-state-marker t) From 9db94175de10b7f316305a84388bcc6687995d65 Mon Sep 17 00:00:00 2001 From: Wolfgang Jenkner Date: Mon, 12 Nov 2012 18:12:33 +0100 Subject: [PATCH 20/23] lisp/ansi-color.el (ansi-color-apply-sequence): Implement SGR codes 39 and 49. This fixes bug#12792. Also, treat unimplemented parameters as 0, thereby restoring the behavior of revisions prior to 2012-08-15T03:33:55Z!monnier@iro.umontreal.ca. --- lisp/ChangeLog | 7 ++++++ lisp/ansi-color.el | 57 +++++++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 86bae4ec777..a927c010724 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-11-12 Wolfgang Jenkner + + * ansi-color.el (ansi-color-apply-sequence): Implement SGR codes + 39 and 49. This fixes bug#12792. Also, treat unimplemented + parameters as 0, thereby restoring the behavior of revisions prior + to 2012-08-15T03:33:55Z!monnier@iro.umontreal.ca. + 2012-11-12 Fabián Ezequiel Gallina Fix end-of-defun misbehavior. diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 047b4b944b9..da2880c404c 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -534,34 +534,39 @@ Returns nil only if there's no match for `ansi-color-parameter-regexp'." ESCAPE-SEQ is an escape sequence parsed by `ansi-color-parse-sequence'. -If the new codes resulting from ESCAPE-SEQ start with 0, then the -old codes are discarded and the remaining new codes are -processed. Otherwise, for each new code: if it is 21-25 or 27-29 -delete appropriate parameters from the list of codes; any other -code that makes sense is added to the list of codes. Finally, -the so changed list of codes is returned." +For each new code, the following happens: if it is 1-7, add it to +the list of codes; if it is 21-25 or 27, delete appropriate +parameters from the list of codes; if it is 30-37 resp. 39, the +foreground color code is replaced or added resp. deleted; if it +is 40-47 resp. 49, the background color code is replaced or added +resp. deleted; any other code is discarded together with the old +codes. Finally, the so changed list of codes is returned." (let ((new-codes (ansi-color-parse-sequence escape-sequence))) (while new-codes - (setq codes - (let ((new (pop new-codes))) - (cond ((zerop new) - nil) - ((or (<= new 20) - (>= new 30)) - (if (memq new codes) - codes - (cons new codes))) - ;; The standard says `21 doubly underlined' while - ;; http://en.wikipedia.org/wiki/ANSI_escape_code claims - ;; `21 Bright/Bold: off or Underline: Double'. - ((/= new 26) - (remq (- new 20) - (cond ((= new 22) - (remq 1 codes)) - ((= new 25) - (remq 6 codes)) - (t codes)))) - (t codes))))) + (let* ((new (pop new-codes)) + (q (/ new 10))) + (setq codes + (pcase q + (0 (unless (memq new '(0 8 9)) + (cons new (remq new codes)))) + (2 (unless (memq new '(20 26 28 29)) + ;; The standard says `21 doubly underlined' while + ;; http://en.wikipedia.org/wiki/ANSI_escape_code claims + ;; `21 Bright/Bold: off or Underline: Double'. + (remq (- new 20) (pcase new + (22 (remq 1 codes)) + (25 (remq 6 codes)) + (_ codes))))) + ((or 3 4) (let ((r (mod new 10))) + (unless (= r 8) + (let (beg) + (while (and codes (/= q (/ (car codes) 10))) + (push (pop codes) beg)) + (setq codes (nconc (nreverse beg) (cdr codes))) + (if (= r 9) + codes + (cons new codes)))))) + (_ nil))))) codes)) (defun ansi-color-make-color-map () From 53f8dc848222e162de1e62a1253cd9d0f6bed14f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 12 Nov 2012 14:44:39 -0500 Subject: [PATCH 21/23] NEWS updates for the ever-changing python.el --- etc/NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 6913909c6a8..623b40bb64f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -524,6 +524,8 @@ python-insert-while | python-skeleton-while python-find-function | python-nav-jump-to-defun python-next-statement | python-nav-forward-sentence python-previous-statement | python-nav-backward-sentence +python-beginning-of-defun-function | python-nav-beginning-of-defun +python-end-of-defun-function | python-nav-end-of-defun python-send-buffer | python-shell-send-buffer python-send-defun | python-shell-send-defun python-send-region | python-shell-send-region From 0f5414fca8a5639d9417c99e18bb4dae35d83fd3 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 13 Nov 2012 03:54:37 +0800 Subject: [PATCH 22/23] Doc fix for gdb-stopped-functions. * building.texi (Multithreaded Debugging): gdb-stopped-hooks is actually named gdb-stopped-functions. --- doc/emacs/ChangeLog | 5 +++++ doc/emacs/building.texi | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 4591cfb99fe..45d4377f34a 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2012-11-12 Chong Yidong + + * building.texi (Multithreaded Debugging): gdb-stopped-hooks is + actually named gdb-stopped-functions. + 2012-11-12 Glenn Morris * misc.texi (Single Shell): Mention async-shell-command-buffer. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 3a3630138de..e0ea72902fb 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -1244,8 +1244,8 @@ depending on the reason which caused the stop. Customize the variable @code{gdb-switch-reasons} to select the stop reasons which will cause a thread switch. -@vindex gdb-stopped-hooks - The variable @code{gdb-stopped-hooks} allows you to execute your +@vindex gdb-stopped-functions + The variable @code{gdb-stopped-functions} allows you to execute your functions whenever some thread stops. In non-stop mode, you can switch between different modes for GUD From f8705f6e3102454bf1e3213956eb3ac8160ff047 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 12 Nov 2012 16:31:15 -0500 Subject: [PATCH 23/23] * lisp/emacs-lisp/gv.el (gv-define-simple-setter): One more fix. Fixes: debbugs:12871 --- lisp/ChangeLog | 8 ++++++-- lisp/emacs-lisp/gv.el | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a927c010724..2ad7230e912 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-11-12 Stefan Monnier + + * emacs-lisp/gv.el (gv-define-simple-setter): One more fix (bug#12871). + 2012-11-12 Wolfgang Jenkner * ansi-color.el (ansi-color-apply-sequence): Implement SGR codes @@ -13,7 +17,7 @@ correctly. (python-nav-end-of-defun): Rename from python-end-of-defun-function. Ensure forward movement. - (python-info-current-defun): Reimplemented to work as intended + (python-info-current-defun): Reimplement to work as intended with new fixed python-nav-{end,beginning}-of-defun. Stop scanning parent defuns as soon as possible. @@ -62,7 +66,7 @@ 2012-11-09 Jan Djärv - * server.el (server-create-window-system-frame): Improved comment. + * server.el (server-create-window-system-frame): Improve comment. 2012-11-08 Jan Djärv diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 38bb6319a03..965fc1c3ef0 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -220,8 +220,9 @@ so as to preserve the semantics of `setf'." `(gv-define-setter ,name (val &rest args) ,(if fix-return `(macroexp-let2 nil v val - (cons ',setter (append args (list v))) - v) + `(progn + (,',setter ,@(append args (list v))) + ,v)) `(cons ',setter (append args (list val)))))) ;;; Typical operations on generalized variables.