commit a11756ad0e2ee719266c0081150c20996cce8e0d (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sun Apr 3 23:16:35 2016 -0700 Spelling fixes diff --git a/ChangeLog.2 b/ChangeLog.2 index 5253a92..bc09faf 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -5798,7 +5798,7 @@ that as the same name can be used for different locations in different SES sheets ; 2) use `local-variable-if-set-p' rather than `boundp' and `local-variable-p' to check if cell name is already in use in this - sheet or needs initialisation. + sheet or needs initialization. (ses-relocate-all): Cell value relocation : 1) like for name relocation use the `ses-cell' property rather than comparing actual name to corresponding standard name. 2) Correct bug introduced in diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 8d3df55..b66f779 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2441,7 +2441,7 @@ When opening a TLS connection, this should be where the first element is the TLS type (which should either be @code{gnutls-x509pki} or @code{gnutls-anon}, and the remaining elements should form a keyword list acceptable for @code{gnutls-boot}. (This keyword list can be -optained from the @code{gnutls-boot-parameters} function.) The TLS +obtained from the @code{gnutls-boot-parameters} function.) The TLS connection will then be negotiated after completing the connection to the host. diff --git a/doc/misc/emacs-gnutls.texi b/doc/misc/emacs-gnutls.texi index 115727f..9d52508 100644 --- a/doc/misc/emacs-gnutls.texi +++ b/doc/misc/emacs-gnutls.texi @@ -181,7 +181,7 @@ syntax are the same as those given to @code{open-network-stream} Manual}). The connection process is called @var{name} (made unique if necessary). This function returns the connection process. -The @var{nowait} parameter means that the scoket should be +The @var{nowait} parameter means that the socket should be asynchronous, and the connection process will be returned to the caller before TLS negotiation has happened. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index eb10c84..67cb102 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -289,7 +289,7 @@ BUFFER defaults to current buffer. Does not modify BUFFER." "Mocks function NAME with MOCK and run BODY. Once BODY finishes (be it normally by returning a value or -abnormally by throwing or signalling), the old definition of +abnormally by throwing or signaling), the old definition of function NAME is restored. BODY may further change the mock with `fset'. diff --git a/lisp/gnus/ChangeLog.1 b/lisp/gnus/ChangeLog.1 index 47eb34e..475af05 100644 --- a/lisp/gnus/ChangeLog.1 +++ b/lisp/gnus/ChangeLog.1 @@ -3230,7 +3230,7 @@ * gnus-picon.el (gnus-picons-display-pairs): Don't add two bars. (gnus-picons-try-face): Set the foreground color on the bar. - (gnus-picons-group-exluded-groups): New variable. + (gnus-picons-group-excluded-groups): New variable. (gnus-group-display-picons): Use it. 1997-10-13 Lars Magne Ingebrigtsen diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 33ea152..98195da 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1630,7 +1630,7 @@ identifiers. If you change this variable's value, call the function `c-make-noise-macro-regexps' to set the necessary internal variables (or do -this implicitly by reinitialising C/C++/Objc Mode on any buffer)." +this implicitly by reinitializing C/C++/Objc Mode on any buffer)." :type '(repeat :tag "List of names" string) :group 'c) diff --git a/lisp/svg.el b/lisp/svg.el index b6beaad..0b45c5c 100644 --- a/lisp/svg.el +++ b/lisp/svg.el @@ -29,7 +29,7 @@ (require 'dom) (defun svg-create (width height &rest args) - "Create a new, empty SVG image with dimentions WIDTHxHEIGHT. + "Create a new, empty SVG image with dimensions WIDTHxHEIGHT. ARGS can be used to provide `stroke' and `stroke-width' parameters to any further elements added." (dom-node 'svg diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 702772c..5fb93bc 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -282,7 +282,7 @@ If no list entry produces a useful revision, return `nil'." :group 'vc-hg) (defcustom vc-hg-use-file-version-for-mode-line-version nil - "When enabled, the modeline will contain revision informtion for the visited file. + "When enabled, the modeline contains revision information for the visited file. When not, the revision in the modeline is for the repository working copy. `nil' is the much faster setting for large repositories." diff --git a/src/process.c b/src/process.c index 198e7de..399cd8a 100644 --- a/src/process.c +++ b/src/process.c @@ -5509,7 +5509,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, { #ifdef HAVE_GNUTLS /* If we have an incompletely set up TLS connection, - then defer the sentinel signalling until + then defer the sentinel signaling until later. */ if (NILP (p->gnutls_boot_parameters) && !p->gnutls_p) diff --git a/src/xdisp.c b/src/xdisp.c index 457f28a..9b7ac3c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9844,7 +9844,7 @@ argument as small as possible; in particular, if the buffer contains long lines that shall be truncated anyway. The optional argument Y-LIMIT, if non-nil, specifies the maximum text -height (exluding the height of the mode- or header-line, if any) that +height (excluding the height of the mode- or header-line, if any) that can be returned. Text lines whose y-coordinate is beyond Y-LIMIT are ignored. Since calculating the text height of a large buffer can take some time, it makes sense to specify this argument if the size of the diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 49a861d..9c19e63 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1055,8 +1055,8 @@ the file watch." (file-notify--deftest-remote file-notify-test08-watched-file-in-watched-dir "Check `file-notify-test08-watched-file-in-watched-dir' for remote files.") -(ert-deftest file-notify-test09-sufficient-ressources () - "Check that file notification does not use too many ressources." +(ert-deftest file-notify-test09-sufficient-resources () + "Check that file notification does not use too many resources." :tags '(:expensive-test) (skip-unless (file-notify--test-local-enabled)) ;; This test is intended for kqueue only. @@ -1093,8 +1093,8 @@ the file watch." ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test09-sufficient-ressources - "Check `file-notify-test09-sufficient-ressources' for remote files.") +(file-notify--deftest-remote file-notify-test09-sufficient-resources + "Check `file-notify-test09-sufficient-resources' for remote files.") (defun file-notify-test-all (&optional interactive) "Run all tests for \\[file-notify]." diff --git a/test/manual/etags/cp-src/functions.cpp b/test/manual/etags/cp-src/functions.cpp index fb546ed..764498d 100644 --- a/test/manual/etags/cp-src/functions.cpp +++ b/test/manual/etags/cp-src/functions.cpp @@ -1,7 +1,7 @@ #include "main.hpp" #pragma ident "@(#)functions.cpp 1.0 98/11/12 (c) Rupak Rathore" -// Constructor default argument initialises to today's values +// Constructor default argument initializes to today's values void Date::setDate ( int d , int m , int y ){ time_t t; struct tm * ptm; @@ -9,9 +9,9 @@ void Date::setDate ( int d , int m , int y ){ if ( date != NULL ) delete date; date = NULL; - if ( d == 0 && m == 0 && y == 0 ) // explicity called or default constructor hence leave it. + if ( d == 0 && m == 0 && y == 0 ) //Explicitly called or default constructor hence leave it. return; - if ( d < 0 && m < 0 && d < 0 ) // Special instruction to intialise to today's value + if ( d < 0 && m < 0 && d < 0 ) //Special instruction to initialize to today's value d=m=y=0; date = new tm; ptm=localtime ( &t ) ; diff --git a/test/manual/etags/html-src/software.html b/test/manual/etags/html-src/software.html index b5de1e6..dbf8228 100644 --- a/test/manual/etags/html-src/software.html +++ b/test/manual/etags/html-src/software.html @@ -123,7 +123,7 @@
Since then, the original authors Richard I. Shrager, A.Jutan, Ray Muzic, and Sean Brennan agreed to put it under the GPL. Matthias Jueschke tested -the program using a non-linear optimisation test suite, and was satisfied with the results. commit 0695108b9e2d5ed6d424f241af35947f87578975 Author: John Wiegley Date: Sun Apr 3 15:46:53 2016 -0700 Revert "Add `r'/`l' grep command history commands" This reverts commit a32eea60ac90d367435860fe3a10bf843e6f497c. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 059c7ca..03fa0ed 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -390,13 +390,6 @@ is called with the file name as the parameter and should return non-nil if the buffer is to be saved), and any other non-@code{nil} value means that all buffers should be saved without asking. - In addition to the normal compilation mode commands (for -next/previous match and so on), two additional commands are available -for accessing the @command{grep} command history. @kbd{l} -(@code{grep-backward-history}) will re-run successively the previous -@command{grep} commands, and @kbd{r} (@code{grep-forward-history} -will go ``forward'' in the command history. - @findex grep-find @findex find-grep The command @kbd{M-x grep-find} (also available as @kbd{M-x diff --git a/etc/NEWS b/etc/NEWS index 34f18e9..6ef196a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -57,10 +57,6 @@ has been added. They are: 'file-attribute-type', ** The new function 'buffer-hash' has been added, and can be used to compute a fash, non-consing hash of the contents of a buffer. -+++ -** The grep mode now has a command history that you can access via the -`r' and `l' commands. - --- ** 'fill-paragraph' no longer marks the buffer as changed unless it actually changed something. @@ -1811,7 +1807,6 @@ behavior, set 'diff-switches' to '-c'. dynamically. Any third-party code that changes these templates should be updated accordingly. -+++ ** The grep/rgrep/lgrep functions will now ask about saving files before running. This is controlled by the 'grep-save-buffers' variable. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 7ce787e..2b44b58 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -271,8 +271,6 @@ See `compilation-error-screen-columns'" (define-key map "{" 'compilation-previous-file) (define-key map "}" 'compilation-next-file) (define-key map "\t" 'compilation-next-error) - (define-key map "r" 'grep-forward-history) - (define-key map "l" 'grep-backward-history) (define-key map [backtab] 'compilation-previous-error) ;; Set up the menu-bar @@ -311,12 +309,6 @@ See `compilation-error-screen-columns'" (define-key map [menu-bar grep compilation-next-error] '(menu-item "Next Match" next-error :help "Visit the next match and corresponding location")) - (define-key map [menu-bar grep grep-backward-history] - '(menu-item "Previous Command" grep-backward-history - :help "Run the previous grep command from the command history")) - (define-key map [menu-bar grep grep-forward-history] - '(menu-item "Next Command" grep-forward-history - :help "Run the next grep command from the command history")) map) "Keymap for grep buffers. `compilation-minor-mode-map' is a cdr of this.") @@ -752,43 +744,6 @@ This function is called from `compilation-filter-hook'." grep-error-screen-columns) (add-hook 'compilation-filter-hook 'grep-filter nil t)) -(defvar grep--command-history nil) -(defvar grep--history-inhibit nil) -(defvar grep--history-place 0) - -(defun grep--save-history (command) - (unless grep--history-inhibit - (push (cons default-directory command) grep--command-history) - (setq grep--history-place 0) - ;; Don't let the history grow without bounds. - (when (> (length grep--command-history) 100) - (setcdr (nthcdr 100 grep--command-history) nil)))) - -(defun grep-forward-history () - "Go to the next result in the grep command history. -Also see `grep-backward-history'." - (interactive) - (let ((elem (and (> grep--history-place 0) - (nth (1- grep--history-place) grep--command-history))) - (grep--history-inhibit t)) - (unless elem - (error "Nothing further in the command history")) - (cl-decf grep--history-place) - (let ((default-directory (car elem))) - (grep (cdr elem))))) - -(defun grep-backward-history () - "Go to the previous result in the grep command history. -Also see `grep-forward-history'." - (interactive) - (let ((elem (nth (1+ grep--history-place) grep--command-history)) - (grep--history-inhibit t)) - (unless elem - (error "Nothing further in the command history")) - (cl-incf grep--history-place) - (let ((default-directory (car elem))) - (grep (cdr elem))))) - (defun grep--save-buffers () (when grep-save-buffers (save-some-buffers (and (not (eq grep-save-buffers 'ask)) @@ -825,7 +780,7 @@ list is empty)." (if current-prefix-arg default grep-command) 'grep-history (if current-prefix-arg nil default)))))) - (grep--save-history command-args) + (grep--save-buffers) ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. commit 3a5f146e5abd79c7fb1810f5af99c7d448012604 Author: John Wiegley Date: Sun Apr 3 15:46:52 2016 -0700 Revert "Restore the point in grep buffers when traversing the history" This reverts commit f7c5f79ca565d3ef3feeb1e0af5ca261f1bcf58a. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index fd55576..7ce787e 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -472,12 +472,9 @@ This variable's value takes effect when `grep-compute-defaults' is called.") (defvar grep-files-history nil) ;;;###autoload -(defun grep-process-setup (&optional point) +(defun grep-process-setup () "Setup compilation variables and buffer for `grep'. -Set up `compilation-exit-message-function' and run -`grep-setup-hook'. If the optional parameter POINT is given, -point will be moved to this vicinity when the grep command has -finished." +Set up `compilation-exit-message-function' and run `grep-setup-hook'." (when (eq grep-highlight-matches 'auto-detect) (grep-compute-defaults)) (unless (or (eq grep-highlight-matches 'auto-detect) @@ -498,14 +495,12 @@ finished." ;; This relies on the fact that `compilation-start' ;; sets buffer-modified to nil before running the command, ;; so the buffer is still unmodified if there is no output. - (progn - (goto-char (min point (point-max))) - (cond ((and (zerop code) (buffer-modified-p)) - '("finished (matches found)\n" . "matched")) - ((not (buffer-modified-p)) - '("finished with no matches found\n" . "no match")) - (t - (cons msg code)))) + (cond ((and (zerop code) (buffer-modified-p)) + '("finished (matches found)\n" . "matched")) + ((not (buffer-modified-p)) + '("finished with no matches found\n" . "no match")) + (t + (cons msg code))) (cons msg code)))) (run-hooks 'grep-setup-hook)) @@ -737,10 +732,6 @@ This function is called from `compilation-filter-hook'." ;; Now replace the pattern with the default tag. (replace-match tag-default t t grep-default 1)))) -(defvar grep--command-history nil) -(defvar grep--history-inhibit nil) -(defvar grep--history-place 0) -(defvar grep--history-point 0) ;;;###autoload (define-compilation-mode grep-mode "Grep" @@ -755,19 +746,19 @@ This function is called from `compilation-filter-hook'." ;; can never match. (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`")) (set (make-local-variable 'compilation-process-setup-function) - (lambda () - (grep-process-setup grep--history-point))) + 'grep-process-setup) (set (make-local-variable 'compilation-disable-input) t) (set (make-local-variable 'compilation-error-screen-columns) grep-error-screen-columns) (add-hook 'compilation-filter-hook 'grep-filter nil t)) +(defvar grep--command-history nil) +(defvar grep--history-inhibit nil) +(defvar grep--history-place 0) + (defun grep--save-history (command) (unless grep--history-inhibit - (when grep--command-history - (setcar (cdr (car grep--command-history)) (point))) - (push (list default-directory 0 command) - grep--command-history) + (push (cons default-directory command) grep--command-history) (setq grep--history-place 0) ;; Don't let the history grow without bounds. (when (> (length grep--command-history) 100) @@ -782,11 +773,9 @@ Also see `grep-backward-history'." (grep--history-inhibit t)) (unless elem (error "Nothing further in the command history")) - (setcar (cdr (nth grep--history-place grep--command-history)) (point)) (cl-decf grep--history-place) - (let ((default-directory (car elem)) - (grep--history-point (nth 1 elem))) - (grep (nth 2 elem))))) + (let ((default-directory (car elem))) + (grep (cdr elem))))) (defun grep-backward-history () "Go to the previous result in the grep command history. @@ -796,11 +785,9 @@ Also see `grep-forward-history'." (grep--history-inhibit t)) (unless elem (error "Nothing further in the command history")) - (setcar (cdr (nth grep--history-place grep--command-history)) (point)) (cl-incf grep--history-place) - (let ((default-directory (car elem)) - (grep--history-point (nth 1 elem))) - (grep (nth 2 elem))))) + (let ((default-directory (car elem))) + (grep (cdr elem))))) (defun grep--save-buffers () (when grep-save-buffers commit 969c8a388a859e4366a1fe75ae57939a765874aa Merge: 368cb23 787df9d Author: Paul Eggert Date: Sun Apr 3 13:39:52 2016 -0700 Merge from origin/emacs-25 787df9d ; * src/keyboard.c (read_char): Fix typos in a comment. commit 368cb23fe249334bf9d230755ae07b6410ac6852 Merge: b1c7207 06ae23a Author: Paul Eggert Date: Sun Apr 3 13:39:52 2016 -0700 ; Merge from origin/emacs-25 The following commit was skipped: 06ae23a Handle Bug#23186 commit b1c7207dbbc5b35aa2fa6e69a3041299e881dbb6 Merge: f7c5f79 b787d55 Author: Paul Eggert Date: Sun Apr 3 13:39:52 2016 -0700 Merge from origin/emacs-25 b787d55 More format-time-string change fixups 13c8f29 make-xwidget unused arg cleanup 36e05f0 Remove unused arguments from make-xwidget 1042217 Document incompatible changes in 'format-time-string' 7228eb8 Improve documentation of byte-code objects 0020047 Adapt calls to 'format-time-string' to changes in Emacs 25 17b5152 Improve vc-diff with Git backend c28f87a (js--continued-expression-p): Special-case unary plus and minus 2d02a5f ; * lisp/vc/vc-annotate.el (vc-annotate): Clarify commentary. 9151f16 Prevent C++ Mode wrongly fontifying some identifiers near tem... b3b523c Avoid crashes due to insanely large columns in tabulated-list... a3daa34 Teach M-x disassemble a default argument. e30c3e9 Fix EOL decoding in vc-annotate with SVN back-end on MS-Windows df441b3 Fix OS X specific settings in tramp-tests 2244331 Finish fixing a cacheing bug in CC Mode (see 2016-03-09) # Conflicts: # lisp/net/tramp-sh.el # lisp/progmodes/cc-engine.el commit f7c5f79ca565d3ef3feeb1e0af5ca261f1bcf58a Author: Lars Magne Ingebrigtsen Date: Sun Apr 3 20:13:52 2016 +0200 Restore the point in grep buffers when traversing the history * lisp/progmodes/grep.el (grep-process-setup): Allow moving point to a specific place after finishing the grep command. (grep-mode): Use it to restore point after traversing the history. (grep--history-point): New internal variable. (grep--save-history, grep-forward-history): Use it to restore the point. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 7ce787e..fd55576 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -472,9 +472,12 @@ This variable's value takes effect when `grep-compute-defaults' is called.") (defvar grep-files-history nil) ;;;###autoload -(defun grep-process-setup () +(defun grep-process-setup (&optional point) "Setup compilation variables and buffer for `grep'. -Set up `compilation-exit-message-function' and run `grep-setup-hook'." +Set up `compilation-exit-message-function' and run +`grep-setup-hook'. If the optional parameter POINT is given, +point will be moved to this vicinity when the grep command has +finished." (when (eq grep-highlight-matches 'auto-detect) (grep-compute-defaults)) (unless (or (eq grep-highlight-matches 'auto-detect) @@ -495,12 +498,14 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." ;; This relies on the fact that `compilation-start' ;; sets buffer-modified to nil before running the command, ;; so the buffer is still unmodified if there is no output. - (cond ((and (zerop code) (buffer-modified-p)) - '("finished (matches found)\n" . "matched")) - ((not (buffer-modified-p)) - '("finished with no matches found\n" . "no match")) - (t - (cons msg code))) + (progn + (goto-char (min point (point-max))) + (cond ((and (zerop code) (buffer-modified-p)) + '("finished (matches found)\n" . "matched")) + ((not (buffer-modified-p)) + '("finished with no matches found\n" . "no match")) + (t + (cons msg code)))) (cons msg code)))) (run-hooks 'grep-setup-hook)) @@ -732,6 +737,10 @@ This function is called from `compilation-filter-hook'." ;; Now replace the pattern with the default tag. (replace-match tag-default t t grep-default 1)))) +(defvar grep--command-history nil) +(defvar grep--history-inhibit nil) +(defvar grep--history-place 0) +(defvar grep--history-point 0) ;;;###autoload (define-compilation-mode grep-mode "Grep" @@ -746,19 +755,19 @@ This function is called from `compilation-filter-hook'." ;; can never match. (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`")) (set (make-local-variable 'compilation-process-setup-function) - 'grep-process-setup) + (lambda () + (grep-process-setup grep--history-point))) (set (make-local-variable 'compilation-disable-input) t) (set (make-local-variable 'compilation-error-screen-columns) grep-error-screen-columns) (add-hook 'compilation-filter-hook 'grep-filter nil t)) -(defvar grep--command-history nil) -(defvar grep--history-inhibit nil) -(defvar grep--history-place 0) - (defun grep--save-history (command) (unless grep--history-inhibit - (push (cons default-directory command) grep--command-history) + (when grep--command-history + (setcar (cdr (car grep--command-history)) (point))) + (push (list default-directory 0 command) + grep--command-history) (setq grep--history-place 0) ;; Don't let the history grow without bounds. (when (> (length grep--command-history) 100) @@ -773,9 +782,11 @@ Also see `grep-backward-history'." (grep--history-inhibit t)) (unless elem (error "Nothing further in the command history")) + (setcar (cdr (nth grep--history-place grep--command-history)) (point)) (cl-decf grep--history-place) - (let ((default-directory (car elem))) - (grep (cdr elem))))) + (let ((default-directory (car elem)) + (grep--history-point (nth 1 elem))) + (grep (nth 2 elem))))) (defun grep-backward-history () "Go to the previous result in the grep command history. @@ -785,9 +796,11 @@ Also see `grep-forward-history'." (grep--history-inhibit t)) (unless elem (error "Nothing further in the command history")) + (setcar (cdr (nth grep--history-place grep--command-history)) (point)) (cl-incf grep--history-place) - (let ((default-directory (car elem))) - (grep (cdr elem))))) + (let ((default-directory (car elem)) + (grep--history-point (nth 1 elem))) + (grep (nth 2 elem))))) (defun grep--save-buffers () (when grep-save-buffers commit a32eea60ac90d367435860fe3a10bf843e6f497c Author: Lars Magne Ingebrigtsen Date: Sun Apr 3 19:46:50 2016 +0200 Add `r'/`l' grep command history commands * doc/emacs/building.texi (Grep Searching): Mention the `r'/`l' commands. * lisp/progmodes/grep.el (grep-forward-history): New command. (grep-backward-history): Ditto. (grep--save-buffers): New function. (grep): Use it to record the history. (grep--command-history, grep--history-inhibit) (grep--history-place): New internal variables for the grep history (bug#22627). diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 03fa0ed..059c7ca 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -390,6 +390,13 @@ is called with the file name as the parameter and should return non-nil if the buffer is to be saved), and any other non-@code{nil} value means that all buffers should be saved without asking. + In addition to the normal compilation mode commands (for +next/previous match and so on), two additional commands are available +for accessing the @command{grep} command history. @kbd{l} +(@code{grep-backward-history}) will re-run successively the previous +@command{grep} commands, and @kbd{r} (@code{grep-forward-history} +will go ``forward'' in the command history. + @findex grep-find @findex find-grep The command @kbd{M-x grep-find} (also available as @kbd{M-x diff --git a/etc/NEWS b/etc/NEWS index d878228..88e101e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -57,6 +57,10 @@ has been added. They are: 'file-attribute-type', ** The new function 'buffer-hash' has been added, and can be used to compute a fash, non-consing hash of the contents of a buffer. ++++ +** The grep mode now has a command history that you can access via the +`r' and `l' commands. + --- ** 'fill-paragraph' no longer marks the buffer as changed unless it actually changed something. @@ -1807,6 +1811,7 @@ behavior, set 'diff-switches' to '-c'. dynamically. Any third-party code that changes these templates should be updated accordingly. ++++ ** The grep/rgrep/lgrep functions will now ask about saving files before running. This is controlled by the 'grep-save-buffers' variable. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2b44b58..7ce787e 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -271,6 +271,8 @@ See `compilation-error-screen-columns'" (define-key map "{" 'compilation-previous-file) (define-key map "}" 'compilation-next-file) (define-key map "\t" 'compilation-next-error) + (define-key map "r" 'grep-forward-history) + (define-key map "l" 'grep-backward-history) (define-key map [backtab] 'compilation-previous-error) ;; Set up the menu-bar @@ -309,6 +311,12 @@ See `compilation-error-screen-columns'" (define-key map [menu-bar grep compilation-next-error] '(menu-item "Next Match" next-error :help "Visit the next match and corresponding location")) + (define-key map [menu-bar grep grep-backward-history] + '(menu-item "Previous Command" grep-backward-history + :help "Run the previous grep command from the command history")) + (define-key map [menu-bar grep grep-forward-history] + '(menu-item "Next Command" grep-forward-history + :help "Run the next grep command from the command history")) map) "Keymap for grep buffers. `compilation-minor-mode-map' is a cdr of this.") @@ -744,6 +752,43 @@ This function is called from `compilation-filter-hook'." grep-error-screen-columns) (add-hook 'compilation-filter-hook 'grep-filter nil t)) +(defvar grep--command-history nil) +(defvar grep--history-inhibit nil) +(defvar grep--history-place 0) + +(defun grep--save-history (command) + (unless grep--history-inhibit + (push (cons default-directory command) grep--command-history) + (setq grep--history-place 0) + ;; Don't let the history grow without bounds. + (when (> (length grep--command-history) 100) + (setcdr (nthcdr 100 grep--command-history) nil)))) + +(defun grep-forward-history () + "Go to the next result in the grep command history. +Also see `grep-backward-history'." + (interactive) + (let ((elem (and (> grep--history-place 0) + (nth (1- grep--history-place) grep--command-history))) + (grep--history-inhibit t)) + (unless elem + (error "Nothing further in the command history")) + (cl-decf grep--history-place) + (let ((default-directory (car elem))) + (grep (cdr elem))))) + +(defun grep-backward-history () + "Go to the previous result in the grep command history. +Also see `grep-forward-history'." + (interactive) + (let ((elem (nth (1+ grep--history-place) grep--command-history)) + (grep--history-inhibit t)) + (unless elem + (error "Nothing further in the command history")) + (cl-incf grep--history-place) + (let ((default-directory (car elem))) + (grep (cdr elem))))) + (defun grep--save-buffers () (when grep-save-buffers (save-some-buffers (and (not (eq grep-save-buffers 'ask)) @@ -780,7 +825,7 @@ list is empty)." (if current-prefix-arg default grep-command) 'grep-history (if current-prefix-arg nil default)))))) - + (grep--save-history command-args) (grep--save-buffers) ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. commit 787df9dd053581b7e15fb0cd1ee3e9a17dbd1ad7 Author: Eli Zaretskii Date: Sun Apr 3 20:06:51 2016 +0300 ; * src/keyboard.c (read_char): Fix typos in a comment. diff --git a/src/keyboard.c b/src/keyboard.c index 9618e38..e3858a5 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2837,7 +2837,7 @@ read_char (int commandflag, Lisp_Object map, if (CONSP (c) && EQ (XCAR (c), Qselect_window) && !end_time) /* We stopped being idle for this event; undo that. This prevents automatic window selection (under - mouse_autoselect_window from acting as a real input event, for + mouse-autoselect-window) from acting as a real input event, for example banishing the mouse under mouse-avoidance-mode. */ timer_resume_idle (); commit 1b33cd8e7e5c747afde29e10b5fe192c5a37b67a Author: Michael Albinus Date: Sun Apr 3 17:54:25 2016 +0200 Fix Bug#23186, again * lisp/net/tramp.el (tramp-encoding-shell) (tramp-encoding-command-switch) (tramp-encoding-command-interactive): Check for `w32-shell-name'. (Bug#23186) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fc194fa..4edca5a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -120,8 +120,8 @@ This setting has precedence over `auto-save-file-name-transforms'." (directory :tag "Auto save directory name"))) (defcustom tramp-encoding-shell - (if (memq system-type '(windows-nt)) - (getenv "COMSPEC") + (if (boundp 'w32-shell-name) + (symbol-value 'w32-shell-name) "/bin/sh") "Use this program for encoding and decoding commands on the local host. This shell is used to execute the encoding and decoding command on the @@ -145,17 +145,14 @@ use for the remote host." :group 'tramp :type '(file :must-match t)) -(defcustom tramp-encoding-command-switch - (if (string-match "cmd\\.exe" (or tramp-encoding-shell "")) - "/c" - "-c") +(defcustom tramp-encoding-command-switch (if (boundp 'w32-shell-name) "/c" "-c") "Use this switch together with `tramp-encoding-shell' for local commands. See the variable `tramp-encoding-shell' for more information." :group 'tramp :type 'string) (defcustom tramp-encoding-command-interactive - (unless (string-match "cmd\\.exe" (or tramp-encoding-shell "")) "-i") + (unless (boundp 'w32-shell-name) "-i") "Use this switch together with `tramp-encoding-shell' for interactive shells. See the variable `tramp-encoding-shell' for more information." :version "24.1" commit 06ae23aa1202e547e65ff9f77882de4dd7f1c591 Author: Michael Albinus Date: Sun Apr 3 09:37:16 2016 +0200 Handle Bug#23186 * lisp/net/tramp.el (tramp-encoding-command-switch) (tramp-encoding-command-interactive): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): `tramp-encoding-shell' could be nil. (Bug#23186) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index aa0ac02..79ff1be 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4875,6 +4875,8 @@ connection if a previous connection has died for some reason." (setenv "HISTSIZE" "0")))) (setenv "PROMPT_COMMAND") (setenv "PS1" tramp-initial-end-of-output) + (unless (stringp tramp-encoding-shell) + (tramp-error vec 'file-error "`tramp-encoding-shell' not set")) (let* ((target-alist (tramp-compute-multi-hops vec)) ;; We will apply `tramp-ssh-controlmaster-options' ;; only for the first hop. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 19dced6..26672d1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -180,7 +180,7 @@ use for the remote host." :type '(file :must-match t)) (defcustom tramp-encoding-command-switch - (if (string-match "cmd\\.exe" tramp-encoding-shell) + (if (string-match "cmd\\.exe" (or tramp-encoding-shell "")) "/c" "-c") "Use this switch together with `tramp-encoding-shell' for local commands. @@ -189,7 +189,7 @@ See the variable `tramp-encoding-shell' for more information." :type 'string) (defcustom tramp-encoding-command-interactive - (unless (string-match "cmd\\.exe" tramp-encoding-shell) "-i") + (unless (string-match "cmd\\.exe" (or tramp-encoding-shell "")) "-i") "Use this switch together with `tramp-encoding-shell' for interactive shells. See the variable `tramp-encoding-shell' for more information." :version "24.1" commit b787d5501bad8036016d835faa2f90bb0904c038 Author: Paul Eggert Date: Sat Apr 2 23:43:44 2016 -0700 More format-time-string change fixups * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times): * lisp/org/org.el (org-timestamp-format): Fix doc to match new format-time-string behavior. * lisp/org/ox-icalendar.el (org-icalendar-convert-timestamp): Use (not (not X)) to treat non-nil values of utc arg as UTC. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5b90832..aa0ac02 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1525,7 +1525,7 @@ of." (current-time) time)) ;; With GNU Emacs, `format-time-string' has an - ;; optional parameter UNIVERSAL. This is preferred, + ;; optional parameter ZONE. This is preferred, ;; because we could handle the case when the remote ;; host is located in a different time zone as the ;; local host. diff --git a/lisp/org/org.el b/lisp/org/org.el index 6e7d54d..d2b48a6 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -22663,7 +22663,7 @@ contains commented lines. Otherwise, comment them." "Non-nil when TIMESTAMP has a time specified." (org-element-property :hour-start timestamp)) -(defun org-timestamp-format (timestamp format &optional end utc) +(defun org-timestamp-format (timestamp format &optional end zone) "Format a TIMESTAMP element into a string. FORMAT is a format specifier to be passed to @@ -22672,8 +22672,9 @@ FORMAT is a format specifier to be passed to When optional argument END is non-nil, use end of date-range or time-range, if possible. -When optional argument UTC is non-nil, time will be expressed as -Universal Time." +The optional ZONE is omitted or nil for Emacs local time, t for +Universal Time, `wall' for system wall clock time, or a string as in +`set-time-zone-rule' for a time zone rule." (format-time-string format (apply 'encode-time @@ -22683,7 +22684,7 @@ Universal Time." (if end '(:minute-end :hour-end :day-end :month-end :year-end) '(:minute-start :hour-start :day-start :month-start :year-start))))) - utc)) + zone)) (defun org-timestamp-split-range (timestamp &optional end) "Extract a timestamp object from a date or time range. diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el index 0d34ba1..cd54d1e 100644 --- a/lisp/org/ox-icalendar.el +++ b/lisp/org/ox-icalendar.el @@ -393,7 +393,8 @@ Universal Time, ignoring `org-icalendar-date-time-format'." ;; Convert timestamp into internal time in order to use ;; `format-time-string' and fix any mistake (i.e. MI >= 60). (encode-time 0 mi h d m y) - (or utc (and with-time-p (org-icalendar-use-UTC-date-time-p))))))) + (not (not (or utc (and with-time-p + (org-icalendar-use-UTC-date-time-p))))))))) (defun org-icalendar-dtstamp () "Return DTSTAMP property, as a string." commit 13c8f29ce361e3aad71cf2b44e76d5cfdaf7dda3 Author: Paul Eggert Date: Sat Apr 2 17:50:03 2016 -0700 make-xwidget unused arg cleanup * doc/lispref/display.texi (Xwidgets): Remove stray refs. * src/xwidget.c (syms_of_xwidget): Qwebkit, not Qwebkit_osr. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 2d8b60d..9ea9548 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5642,8 +5642,7 @@ in a @code{display} text or overlay property (@pxref{Display Property}). @defun make-xwidget type title width height arguments &optional buffer -This creates an xwidget object between @var{beg} and @var{end}, buffer -positions in @var{buffer}, and returns the new object. If +This creates and returns an xwidget object. If @var{buffer} is omitted or @code{nil}, it defaults to the current buffer. If @var{buffer} names a buffer that doesn't exist, it will be created. The @var{type} identifies the type of the xwidget component, @@ -5651,7 +5650,7 @@ it can be one of the following: @table @code @item webkit -The WebKit (@dfn{on-stack replacement}) component. +The WebKit component. @end table The @var{width} and @var{height} arguments specify the widget size in diff --git a/src/xwidget.c b/src/xwidget.c index 4f1df1a..8ff4c23 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -187,7 +187,7 @@ Returns the newly constructed xwidget, or nil if construction fails. */) xw->widget_osr = NULL; xw->plist = Qnil; - if (EQ (xw->type, Qwebkit_osr)) + if (EQ (xw->type, Qwebkit)) { block_input (); xw->widgetwindow_osr = gtk_offscreen_window_new (); @@ -197,7 +197,7 @@ Returns the newly constructed xwidget, or nil if construction fails. */) /* WebKit OSR is the only scrolled component at the moment. */ xw->widgetscrolledwindow_osr = NULL; - if (EQ (xw->type, Qwebkit_osr)) + if (EQ (xw->type, Qwebkit)) { xw->widgetscrolledwindow_osr = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_min_content_height @@ -218,7 +218,7 @@ Returns the newly constructed xwidget, or nil if construction fails. */) gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, xw->height); - if (EQ (xw->type, Qwebkit_osr)) + if (EQ (xw->type, Qwebkit)) { gtk_container_add (GTK_CONTAINER (xw->widgetwindow_osr), xw->widgetscrolledwindow_osr); @@ -239,7 +239,7 @@ Returns the newly constructed xwidget, or nil if construction fails. */) g_object_set_data (G_OBJECT (xw->widgetwindow_osr), XG_XWIDGET, xw); /* signals */ - if (EQ (xw->type, Qwebkit_osr)) + if (EQ (xw->type, Qwebkit)) { g_signal_connect (G_OBJECT (xw->widget_osr), "document-load-finished", @@ -497,7 +497,7 @@ xwidget_init_view (struct xwidget *xww, XSETWINDOW (xv->w, s->w); XSETXWIDGET (xv->model, xww); - if (EQ (xww->type, Qwebkit_osr)) + if (EQ (xww->type, Qwebkit)) { xv->widget = gtk_drawing_area_new (); /* Expose event handling. */ @@ -508,7 +508,7 @@ xwidget_init_view (struct xwidget *xww, g_signal_connect (G_OBJECT (xww->widgetwindow_osr), "damage-event", G_CALLBACK (offscreen_damage_event), xv->widget); - if (EQ (xww->type, Qwebkit_osr)) + if (EQ (xww->type, Qwebkit)) { g_signal_connect (G_OBJECT (xv->widget), "button-press-event", G_CALLBACK (xwidget_osr_event_forward), NULL); @@ -983,7 +983,7 @@ syms_of_xwidget (void) defsubr (&Sxwidget_webkit_goto_uri); defsubr (&Sxwidget_webkit_execute_script); defsubr (&Sxwidget_webkit_get_title); - DEFSYM (Qwebkit_osr, "webkit"); + DEFSYM (Qwebkit, "webkit"); defsubr (&Sxwidget_size_request); defsubr (&Sdelete_xwidget_view); commit 36e05f0bf713175a06d14255cf707543ad1a296e Author: Joakim Verona Date: Sat Apr 2 17:49:27 2016 -0700 Remove unused arguments from make-xwidget The arguments BEG and END were unused, and are now removed. * display.texi (Xwidgets): Document the change * xwidget.el (make-xwidget, xwidget-insert) (xwidget-webkit-new-session): Reflect changed arguments * xwidget.c (Fmake_xwidget, syms_of_xwidget): Reflect changed arguments diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index e4aff43..2d8b60d 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5641,7 +5641,7 @@ xwidget object, and then use that object as the display specifier in a @code{display} text or overlay property (@pxref{Display Property}). -@defun make-xwidget beg end type title width height arguments &optional buffer +@defun make-xwidget type title width height arguments &optional buffer This creates an xwidget object between @var{beg} and @var{end}, buffer positions in @var{buffer}, and returns the new object. If @var{buffer} is omitted or @code{nil}, it defaults to the current @@ -5650,8 +5650,8 @@ created. The @var{type} identifies the type of the xwidget component, it can be one of the following: @table @code -@item webkit-osr -The WebKit OSR (@dfn{on-stack replacement}) component. +@item webkit +The WebKit (@dfn{on-stack replacement}) component. @end table The @var{width} and @var{height} arguments specify the widget size in diff --git a/lisp/xwidget.el b/lisp/xwidget.el index cd8ec0e..19f631f 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el @@ -42,7 +42,7 @@ The possible values are: `native' or `image'." :type '(choice (const native) (const image))) (declare-function make-xwidget "xwidget.c" - (beg end type title width height arguments &optional buffer)) + (type title width height arguments &optional buffer)) (declare-function xwidget-set-adjustment "xwidget.c" (xwidget axis relative value)) (declare-function xwidget-buffer "xwidget.c" (xwidget)) @@ -66,8 +66,7 @@ See `make-xwidget' for the possible TYPE values. The usage of optional argument ARGS depends on the xwidget. This returns the result of `make-xwidget'." (goto-char pos) - (let ((id (make-xwidget (point) (point) - type title width height args))) + (let ((id (make-xwidget type title width height args))) (put-text-property (point) (+ 1 (point)) 'display (list 'xwidget ':xwidget id)) id)) @@ -454,7 +453,7 @@ For example, use this to display an anchor." (setq xwidget-webkit-last-session-buffer (switch-to-buffer (get-buffer-create bufname))) (insert " 'a' adjusts the xwidget size.") - (setq xw (xwidget-insert 1 'webkit-osr bufname 1000 1000)) + (setq xw (xwidget-insert 1 'webkit bufname 1000 1000)) (xwidget-put xw 'callback 'xwidget-webkit-callback) (xwidget-webkit-mode) (xwidget-webkit-goto-uri (xwidget-webkit-last-session) url))) diff --git a/src/xwidget.c b/src/xwidget.c index c24475f..4f1df1a 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -156,27 +156,23 @@ webkit_navigation_policy_decision_requested_cb (WebKitWebView *, DEFUN ("make-xwidget", Fmake_xwidget, Smake_xwidget, - 7, 8, 0, - doc: /* Make an xwidget from BEG to END of TYPE. + 5, 6, 0, + doc: /* Make an xwidget of TYPE. If BUFFER is nil, use the current buffer. If BUFFER is a string and no such buffer exists, create it. TYPE is a symbol which can take one of the following values: -- webkit-osr +- webkit Returns the newly constructed xwidget, or nil if construction fails. */) - (Lisp_Object beg, Lisp_Object end, Lisp_Object type, + (Lisp_Object type, Lisp_Object title, Lisp_Object width, Lisp_Object height, Lisp_Object arguments, Lisp_Object buffer) { CHECK_SYMBOL (type); CHECK_NATNUM (width); CHECK_NATNUM (height); - /* This should work a bit like "make-button" - (make-button BEG END &rest PROPERTIES) - TYPE etc. should be keyword args eventually. - (make-xwidget 3 3 'button "oei" 31 31 nil) - (xwidget-info (car xwidget-list)) */ + struct xwidget *xw = allocate_xwidget (); Lisp_Object val; xw->type = type; @@ -987,7 +983,7 @@ syms_of_xwidget (void) defsubr (&Sxwidget_webkit_goto_uri); defsubr (&Sxwidget_webkit_execute_script); defsubr (&Sxwidget_webkit_get_title); - DEFSYM (Qwebkit_osr, "webkit-osr"); + DEFSYM (Qwebkit_osr, "webkit"); defsubr (&Sxwidget_size_request); defsubr (&Sdelete_xwidget_view); commit 104221731eb0e24bd6ec4c9e63f4f7590fd07c97 Author: Eli Zaretskii Date: Sat Apr 2 16:23:05 2016 +0300 Document incompatible changes in 'format-time-string' * etc/NEWS: Mention the incompatible change in the interpretation of the 3rd argument to 'format-time-string'. (Bug#21943) diff --git a/etc/NEWS b/etc/NEWS index 5599bd9..7de746e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1771,6 +1771,11 @@ rule. The affected functions are 'current-time-string', function 'encode-time', which already accepted a simple time zone rule argument, has been extended to accept all the new forms. +*** Incompatible change in the third argument of 'format-time-string'. +Previously, any non-nil argument was interpreted as a UTC time zone. +This is no longer true; packages that want UTC time zone should pass t +as the third argument. + *** Time-related functions now consistently accept numbers (representing seconds since the epoch) and nil (representing the current time) as well as the usual list-of-integer representation. commit 7228eb805d355b26cdf2c2202d46f9784e73fd22 Author: Eli Zaretskii Date: Sat Apr 2 15:13:00 2016 +0300 Improve documentation of byte-code objects * doc/lispref/compile.texi (Byte-Code Objects): Document the integer format of the argument descriptor. (Bug#23061) diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index f7fed5e..c943a6a 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -533,8 +533,19 @@ there is no maximum number, but only the first six elements have any normal use. They are: @table @var -@item arglist -The list of argument symbols. +@item argdesc +The descriptor of the arguments. This can either be a list of +arguments, as described in @ref{Argument List}, or an integer encoding +the required number of arguments. In the latter case, the value of +the descriptor specifies the minimum number of arguments in the bits +zero to 6, and the maximum number of arguments in bits 8 to 14. If +the argument list uses @code{&rest}, then bit 7 is set; otherwise it's +cleared. + +If @var{argdesc} is a list, the arguments will be dynamically bound +before executing the byte code. If @var{argdesc} is an integer, the +arguments will be instead pushed onto the stack of the byte-code +interpreter, before executing the code. @item byte-code The string containing the byte-code instructions. @@ -562,11 +573,11 @@ representation. It is the definition of the command @code{backward-sexp}. @example -#[(&optional arg) - "^H\204^F^@@\301^P\302^H[!\207" - [arg 1 forward-sexp] - 2 - 254435 +#[256 + "\211\204^G^@@\300\262^A\301^A[!\207" + [1 forward-sexp] + 3 + 1793299 "^p"] @end example commit 0020047fdaf6b180009e2f5bb24975fc8ed75136 Author: Eli Zaretskii Date: Sat Apr 2 14:25:47 2016 +0300 Adapt calls to 'format-time-string' to changes in Emacs 25 * lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries): Use t as the last argument to format-time-string. (Bug#23128) * lisp/gnus/gmm-utils.el (gmm-format-time-string): Use t as the last argument to format-time-string, when the TZ argument is not a number, per the doc string. diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el index 6049f48..fca2394 100644 --- a/lisp/gnus/gmm-utils.el +++ b/lisp/gnus/gmm-utils.el @@ -473,7 +473,7 @@ specifiers `%Z' and `%z' will be replaced with a numeric form. " (setq st nd)) (push (substring format-string st) rest) (format-time-string (apply 'concat (nreverse rest)) time)) - (format-time-string format-string time tz))) + (format-time-string format-string time t))) (provide 'gmm-utils) diff --git a/lisp/vc/pcvs-info.el b/lisp/vc/pcvs-info.el index 1abc772..b9ecc89 100644 --- a/lisp/vc/pcvs-info.el +++ b/lisp/vc/pcvs-info.el @@ -465,7 +465,7 @@ DIR can also be a file." ((equal date "Result of merge") (setq subtype 'MERGED)) ((let ((mtime (nth 5 (file-attributes (concat dir f)))) (system-time-locale "C")) - (setq timestamp (format-time-string "%c" mtime 'utc)) + (setq timestamp (format-time-string "%c" mtime t)) ;; Solaris sometimes uses "Wed Sep 05", not "Wed Sep 5". ;; See "grep '[^a-z_]ctime' cvs/src/*.c" for reference. (if (= (aref timestamp 8) ?0) commit 17b5152d737e74a3b99a98f3be9866facee8865f Author: Eli Zaretskii Date: Sat Apr 2 12:25:15 2016 +0300 Improve vc-diff with Git backend * lisp/vc/vc-git.el (vc-git-command): Don't override coding-system-for-read/write if they are already bound. Suggested by joaotavora@gmail.com (João Távora). (Bug#20892) (vc-git-print-log): Don't override coding-system-for-read if it's already bound. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 1c43e3e..2921b64 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -853,7 +853,8 @@ If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'. \(This requires at least Git version 1.5.6, for the --graph option.) If START-REVISION is non-nil, it is the newest revision to show. If LIMIT is non-nil, show no more than this many entries." - (let ((coding-system-for-read vc-git-commits-coding-system)) + (let ((coding-system-for-read + (or coding-system-for-read vc-git-commits-coding-system))) ;; `vc-do-command' creates the buffer, but we need it before running ;; the command. (vc-setup-buffer buffer) @@ -1385,8 +1386,10 @@ This command shares argument histories with \\[rgrep] and \\[grep]." "A wrapper around `vc-do-command' for use in vc-git.el. The difference to vc-do-command is that this function always invokes `vc-git-program'." - (let ((coding-system-for-read vc-git-commits-coding-system) - (coding-system-for-write vc-git-commits-coding-system)) + (let ((coding-system-for-read + (or coding-system-for-read vc-git-commits-coding-system)) + (coding-system-for-write + (or coding-system-for-write vc-git-commits-coding-system))) (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program ;; http://debbugs.gnu.org/16897 (unless (and (not (cdr-safe file-or-list)) commit c28f87a53d4955396a3e3cb0223500eca921a872 Author: Dmitry Gutov Date: Sat Apr 2 03:02:03 2016 +0300 (js--continued-expression-p): Special-case unary plus and minus * lisp/progmodes/js.el (js--continued-expression-p): Make an effort to recognize unary plus and minus, in the contexts where they make sense (https://github.com/mooz/js2-mode/issues/322). diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 15a52ba..8c93ffa 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1770,16 +1770,20 @@ This performs fontification according to `js--class-styles'." "Return non-nil if the current line continues an expression." (save-excursion (back-to-indentation) - (or (js--looking-at-operator-p) - (and (js--re-search-backward "\n" nil t) - (progn - (skip-chars-backward " \t") - (or (bobp) (backward-char)) - (and (> (point) (point-min)) - (save-excursion (backward-char) (not (looking-at "[/*]/"))) - (js--looking-at-operator-p) - (and (progn (backward-char) - (not (looking-at "+\\+\\|--\\|/[/*]")))))))))) + (if (js--looking-at-operator-p) + (or (not (memq (char-after) '(?- ?+))) + (progn + (forward-comment (- (point))) + (not (memq (char-before) '(?, ?\[ ?\())))) + (and (js--re-search-backward "\n" nil t) + (progn + (skip-chars-backward " \t") + (or (bobp) (backward-char)) + (and (> (point) (point-min)) + (save-excursion (backward-char) (not (looking-at "[/*]/"))) + (js--looking-at-operator-p) + (and (progn (backward-char) + (not (looking-at "+\\+\\|--\\|/[/*]")))))))))) (defun js--end-of-do-while-loop-p () diff --git a/test/indent/js.js b/test/indent/js.js index d843f61..61c7b44 100644 --- a/test/indent/js.js +++ b/test/indent/js.js @@ -95,6 +95,12 @@ Foobar console.log(num); }); +var arr = [ + -1, 2, + -3, 4 + + -5 +]; + // Local Variables: // indent-tabs-mode: nil // js-indent-level: 2 commit 2d02a5f729c804e841fee5df5b2ae2a06b705bd3 Author: Eli Zaretskii Date: Fri Apr 1 23:22:52 2016 +0300 ; * lisp/vc/vc-annotate.el (vc-annotate): Clarify commentary. diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 379ac95..774453f 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -432,10 +432,11 @@ should be applied to the background or to the foreground." (with-output-to-temp-buffer temp-buffer-name (let ((backend (or vc-bk (vc-backend file))) (coding-system-for-read buffer-file-coding-system)) - ;; On DOS/Windows, "svn annotate" will produce CRLF EOLs even - ;; if the original file has Unix EOLs, which will show ^M - ;; characters in the Annotate buffer. Prevent that by forcing - ;; DOS EOL decoding. + ;; For a VC backend running on DOS/Windows, it's normal to + ;; produce CRLF EOLs even if the original file has Unix EOLs, + ;; which will show ^M characters in the Annotate buffer. (One + ;; known case in point is "svn annotate".) Prevent that by + ;; forcing DOS EOL decoding. (if (memq system-type '(windows-nt ms-dos)) (setq coding-system-for-read (coding-system-change-eol-conversion coding-system-for-read commit 9151f16e8131e6fcd94aa9c8a1b10d9b08656b64 Author: Alan Mackenzie Date: Fri Apr 1 12:50:14 2016 +0000 Prevent C++ Mode wrongly fontifying some identifiers near templates as types This fixes debbugs #7917. * lisp/progmodes/cc-engine.el (c-forward-keyword-prefixed-id): Accept 'maybe (from c-forward-type) as sufficient to record an id. Record type id as well as ref ids. (c-forward-name): Bind c-last-identifier-range around the call to c-forward-<>-arglist to prevent it getting corrupted. Don't automatically assume an identifier is a type when a template ">" is followed by a "(". (c-forward-type): Don't automatically assume an identifier is a type when a template ">" is followed by a "(". * lisp/progmodes/cc-fonts.el (c-font-lock-<>-arglists): Don't fontify an identifier as a type when its associated ">" is followed by a "(". diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index aac7e63..62bc236 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -5812,10 +5812,11 @@ comment at the start of cc-engine.el for more info." nil (and (looking-at c-keywords-regexp) (c-forward-keyword-clause 1)))) - (when (memq res '(t known found prefix)) - ,(when (eq type 'ref) - `(when c-record-type-identifiers - (c-record-ref-id c-last-identifier-range))) + (when (memq res '(t known found prefix maybe)) + (when c-record-type-identifiers + ,(if (eq type 'type) + `(c-record-type-id c-last-identifier-range) + `(c-record-ref-id c-last-identifier-range))) t))) (defmacro c-forward-id-comma-list (type update-safe-pos) @@ -6371,13 +6372,15 @@ comment at the start of cc-engine.el for more info." (eq (char-after) ?<)) ;; Maybe an angle bracket arglist. (when (let ((c-record-type-identifiers t) - (c-record-found-types t)) + (c-record-found-types t) + (c-last-identifier-range)) (c-forward-<>-arglist nil)) - (c-add-type start (1+ pos)) (c-forward-syntactic-ws) - (setq pos (point) - c-last-identifier-range nil) + (unless (eq (char-after) ?\() + (setq c-last-identifier-range nil) + (c-add-type start (1+ pos))) + (setq pos (point)) (if (and c-opt-identifier-concat-key (looking-at c-opt-identifier-concat-key)) @@ -6391,7 +6394,8 @@ comment at the start of cc-engine.el for more info." (c-forward-syntactic-ws) t) - (when (and c-record-type-identifiers id-start) + (when (and c-record-type-identifiers id-start + (not (eq (char-after) ?\())) (c-record-type-id (cons id-start id-end))) (setq res 'template) nil))) @@ -6565,9 +6569,18 @@ comment at the start of cc-engine.el for more info." ;; It's an identifier that might be a type. 'maybe)))) ((eq name-res 'template) - ;; A template is a type. + ;; A template is sometimes a type. (goto-char id-end) - (setq res t)) + (c-forward-syntactic-ws) + (setq res + (if (eq (char-after) ?\() + (if (c-check-type id-start id-end) + ;; It's an identifier that has been used as + ;; a type somewhere else. + 'found + ;; It's an identifier that might be a type. + 'maybe) + t))) (t ;; Otherwise it's an operator identifier, which is not a type. (goto-char start) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 3cc537b..d864367 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -914,7 +914,7 @@ casts and declarations are fontified. Used on level 2 and higher." ;; ;; Fontify types and references in names containing angle bracket ;; arglists from the point to LIMIT. Note that - ;; `c-font-lock-declarations' already has handled many of them. + ;; `c-font-lock-declarations' has already handled many of them. ;; ;; This function might do hidden buffer changes. @@ -976,11 +976,12 @@ casts and declarations are fontified. Used on level 2 and higher." (when (and c-opt-identifier-concat-key (not (get-text-property id-start 'face))) (c-forward-syntactic-ws) - (if (looking-at c-opt-identifier-concat-key) - (c-put-font-lock-face id-start id-end - c-reference-face-name) - (c-put-font-lock-face id-start id-end - 'font-lock-type-face))))) + (cond ((looking-at c-opt-identifier-concat-key) + (c-put-font-lock-face id-start id-end + c-reference-face-name)) + ((eq (char-after) ?\()) + (t (c-put-font-lock-face id-start id-end + 'font-lock-type-face)))))) (goto-char pos))) (goto-char pos))))) commit b3b523cdd66c53677c39f743a18e4c180c2ec248 Author: Eli Zaretskii Date: Fri Apr 1 12:47:29 2016 +0300 Avoid crashes due to insanely large columns in tabulated-list-format * src/xdisp.c (append_stretch_glyph, produce_xwidget_glyph) (produce_image_glyph): Limit the pixel width of the produced glyph to SHRT_MAX. (Bug#23178) (append_composite_glyph, append_glyph, append_glyphless_glyph): Add assertions to verify that the pixel width of the glyph will never overflow a 'short'. * src/term.c (append_composite_glyph): Add assertion to verify that the pixel width of the glyph will never overflow a 'short'. diff --git a/src/term.c b/src/term.c index a77e572..4397210 100644 --- a/src/term.c +++ b/src/term.c @@ -1676,6 +1676,7 @@ append_composite_glyph (struct it *it) glyph = it->glyph_row->glyphs[it->area]; } glyph->type = COMPOSITE_GLYPH; + eassert (it->pixel_width <= SHRT_MAX); glyph->pixel_width = it->pixel_width; glyph->u.cmp.id = it->cmp_it.id; if (it->cmp_it.ch < 0) diff --git a/src/xdisp.c b/src/xdisp.c index 5be94f0..cc2c951 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25828,6 +25828,7 @@ append_glyph (struct it *it) glyph->object = it->object; if (it->pixel_width > 0) { + eassert (it->pixel_width <= SHRT_MAX); glyph->pixel_width = it->pixel_width; glyph->padding_p = false; } @@ -25908,6 +25909,7 @@ append_composite_glyph (struct it *it) } glyph->charpos = it->cmp_it.charpos; glyph->object = it->object; + eassert (it->pixel_width <= SHRT_MAX); glyph->pixel_width = it->pixel_width; glyph->ascent = it->ascent; glyph->descent = it->descent; @@ -26117,7 +26119,7 @@ produce_image_glyph (struct it *it) { glyph->charpos = CHARPOS (it->position); glyph->object = it->object; - glyph->pixel_width = it->pixel_width; + glyph->pixel_width = clip_to_bounds (-1, it->pixel_width, SHRT_MAX); glyph->ascent = glyph_ascent; glyph->descent = it->descent; glyph->voffset = it->voffset; @@ -26221,7 +26223,7 @@ produce_xwidget_glyph (struct it *it) { glyph->charpos = CHARPOS (it->position); glyph->object = it->object; - glyph->pixel_width = it->pixel_width; + glyph->pixel_width = clip_to_bounds (-1, it->pixel_width, SHRT_MAX); glyph->ascent = glyph_ascent; glyph->descent = it->descent; glyph->voffset = it->voffset; @@ -26307,7 +26309,9 @@ append_stretch_glyph (struct it *it, Lisp_Object object, } glyph->charpos = CHARPOS (it->position); glyph->object = object; - glyph->pixel_width = width; + /* FIXME: It would be better to use TYPE_MAX here, but + __typeof__ is not portable enough... */ + glyph->pixel_width = clip_to_bounds (-1, width, SHRT_MAX); glyph->ascent = ascent; glyph->descent = height - ascent; glyph->voffset = it->voffset; @@ -26758,6 +26762,7 @@ append_glyphless_glyph (struct it *it, int face_id, bool for_no_font, int len, } glyph->charpos = CHARPOS (it->position); glyph->object = it->object; + eassert (it->pixel_width <= SHRT_MAX); glyph->pixel_width = it->pixel_width; glyph->ascent = it->ascent; glyph->descent = it->descent; commit a3daa34336da158555d96d670077eedb9eaeeb9c Author: Mark Oteiza Date: Thu Mar 31 19:34:05 2016 -0400 Teach M-x disassemble a default argument. Adopts default argument in the same way as `describe-function'. * lisp/emacs-lisp/disass.el (disassemble): Default to function at point, if any. diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el index e67b022..8506ed6 100644 --- a/lisp/emacs-lisp/disass.el +++ b/lisp/emacs-lisp/disass.el @@ -54,9 +54,13 @@ OBJECT can be a symbol defined as a function, or a function itself \(a lambda expression or a compiled-function object). If OBJECT is not already compiled, we compile it, but do not redefine OBJECT if it is a symbol." - (interactive (list (intern (completing-read "Disassemble function: " - obarray 'fboundp t)) - nil 0 t)) + (interactive + (let* ((fn (function-called-at-point)) + (prompt (if fn (format "Disassemble function (default %s): " fn) + "Disassemble function: ")) + (def (and fn (symbol-name fn)))) + (list (intern (completing-read prompt obarray 'fboundp t nil nil def)) + nil 0 t))) (if (and (consp object) (not (functionp object))) (setq object `(lambda () ,object))) (or indent (setq indent 0)) ;Default indent to zero commit e30c3e9a9cca3ae84d4da132f334f1b8b6df45ac Author: Eli Zaretskii Date: Thu Mar 31 23:01:13 2016 +0300 Fix EOL decoding in vc-annotate with SVN back-end on MS-Windows * lisp/vc/vc-annotate.el (vc-annotate): Force DOS EOL decoding on MS-Windows and MS-DOS, when processing the output of "svn annotate". diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index ed038f1..379ac95 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -432,6 +432,14 @@ should be applied to the background or to the foreground." (with-output-to-temp-buffer temp-buffer-name (let ((backend (or vc-bk (vc-backend file))) (coding-system-for-read buffer-file-coding-system)) + ;; On DOS/Windows, "svn annotate" will produce CRLF EOLs even + ;; if the original file has Unix EOLs, which will show ^M + ;; characters in the Annotate buffer. Prevent that by forcing + ;; DOS EOL decoding. + (if (memq system-type '(windows-nt ms-dos)) + (setq coding-system-for-read + (coding-system-change-eol-conversion coding-system-for-read + 'dos))) (vc-call-backend backend 'annotate-command file (get-buffer temp-buffer-name) rev) ;; we must setup the mode first, and then set our local commit df441b362c25c4ad59ea3d83137328d0d4098eaf Author: Michael Albinus Date: Thu Mar 31 11:45:45 2016 +0200 Fix OS X specific settings in tramp-tests * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. * lisp/net/tramp.el (tramp-get-local-locale): New defun. * test/automated/tramp-tests.el (tramp--test-darwin-p): Remove. (tramp--test-utf8): Improve settings of coding systems. Do not use `tramp--test-darwin-p' anymore. (Bug#22145) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 9fa4610..5b90832 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2865,7 +2865,7 @@ This is like `dired-recursive-delete-directory' for Tramp files." (narrow-to-region (point) (point)) ;; We cannot use `insert-buffer-substring' because the Tramp ;; buffer changes its contents before insertion due to calling - ;; `expand-file' and alike. + ;; `expand-file-name' and alike. (insert (with-current-buffer (tramp-get-buffer v) (buffer-string))) @@ -4865,7 +4865,7 @@ connection if a previous connection has died for some reason." (when (and p (processp p)) (delete-process p)) (setenv "TERM" tramp-terminal-type) - (setenv "LC_ALL" "en_US.utf8") + (setenv "LC_ALL" (tramp-get-local-locale vec)) (if (stringp tramp-histfile-override) (setenv "HISTFILE" tramp-histfile-override) (if tramp-histfile-override diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4396216..19dced6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3939,6 +3939,26 @@ This is used internally by `tramp-file-mode-from-int'." (tramp-compat-funcall 'group-gid) (nth 3 (tramp-compat-file-attributes "~/" id-format)))) +(defun tramp-get-local-locale (&optional vec) + ;; We use key nil for local connection properties. + (with-tramp-connection-property nil "locale" + (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8")) + locale) + (with-temp-buffer + (unless (or (memq system-type '(windows-nt)) + (not (zerop (tramp-call-process + nil "locale" nil t nil "-a")))) + (while candidates + (goto-char (point-min)) + (if (string-match (format "^%s\r?$" (regexp-quote (car candidates))) + (buffer-string)) + (setq locale (car candidates) + candidates nil) + (setq candidates (cdr candidates)))))) + ;; Return value. + (when vec (tramp-message vec 7 "locale %s" (or locale "C"))) + (or locale "C")))) + ;;;###tramp-autoload (defun tramp-check-cached-permissions (vec access) "Check `file-attributes' caches for VEC. diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index d9563ec..a12ee38 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1785,14 +1785,6 @@ Several special characters do not work properly there." (file-truename tramp-test-temporary-file-directory) nil (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) -(defun tramp--test-darwin-p () - "Check, whether the remote host runs Mac OS X. -Several special characters do not work properly there." - ;; We must refill the cache. `file-truename' does it. - (with-parsed-tramp-file-name - (file-truename tramp-test-temporary-file-directory) nil - (string-match "^Darwin" (tramp-get-connection-property v "uname" "")))) - (defun tramp--test-check-files (&rest files) "Run a simple but comprehensive test over every file in FILES." ;; We must use `file-truename' for the temporary directory, because @@ -2041,15 +2033,17 @@ Use the `ls' command." (defun tramp--test-utf8 () "Perform the test in `tramp-test32-utf8*'." - (let ((coding-system-for-read 'utf-8) - (coding-system-for-write 'utf-8) - (file-name-coding-system 'utf-8)) + (let* ((utf8 (if (and (eq system-type 'darwin) + (memq 'utf-8-hfs (coding-system-list))) + 'utf-8-hfs 'utf-8)) + (coding-system-for-read utf8) + (coding-system-for-write utf8) + (file-name-coding-system utf8)) (tramp--test-check-files (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") - (unless (or (tramp--test-hpux-p) (tramp--test-darwin-p)) + (unless (tramp--test-hpux-p) "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") - (unless (tramp--test-darwin-p) - "银河系漫游指南系列") + "银河系漫游指南系列" "Автостопом по гала́ктике"))) (ert-deftest tramp-test32-utf8 () commit 22443312188ff097b69d9ff4b87c2b4f7bbbc263 Author: Alan Mackenzie Date: Wed Mar 30 17:14:03 2016 +0000 Finish fixing a cacheing bug in CC Mode (see 2016-03-09) * lisp/progmodes/cc-cmds.el: (c-beginning-of-defun, c-end-of-defun): Remove superfluous invocations of c-self-bind-state-cache. * lisp/progmodes/cc-defs.el: (c-self-bind-state-cache): Copy and terminate markers correctly. * lisp/progmodes/cc-engine.el (c-record-parse-state-state): Terminate stale markers. diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 764f44a..59f2729 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -1594,70 +1594,69 @@ defun." (c-region-is-active-p) (push-mark)) - (c-self-bind-state-cache ; We must not share with other users of c-state-cache. - (c-save-buffer-state - (beginning-of-defun-function - end-of-defun-function - (start (point)) - (paren-state (c-parse-state)) - (orig-point-min (point-min)) (orig-point-max (point-max)) - lim ; Position of { which has been widened to. - where pos case-fold-search) - - (save-restriction - (if (eq c-defun-tactic 'go-outward) - (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace. - paren-state orig-point-min orig-point-max))) - - ;; Move back out of any macro/comment/string we happen to be in. - (c-beginning-of-macro) - (setq pos (c-literal-limits)) - (if pos (goto-char (car pos))) - - (setq where (c-where-wrt-brace-construct)) - - (if (< arg 0) - ;; Move forward to the closing brace of a function. - (progn - (if (memq where '(at-function-end outwith-function)) - (setq arg (1+ arg))) - (if (< arg 0) - (c-while-widening-to-decl-block - (< (setq arg (- (c-forward-to-nth-EOF-} (- arg) where))) 0))) - ;; Move forward to the next opening brace.... - (when (and (= arg 0) - (progn - (c-while-widening-to-decl-block - (not (c-syntactic-re-search-forward "{" nil 'eob))) - (eq (char-before) ?{))) - (backward-char) - ;; ... and backward to the function header. - (c-beginning-of-decl-1) - t)) - - ;; Move backward to the opening brace of a function, making successively - ;; larger portions of the buffer visible as necessary. - (when (> arg 0) - (c-while-widening-to-decl-block - (> (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))) - - (when (eq arg 0) - ;; Go backward to this function's header. - (c-beginning-of-decl-1) - - (setq pos (point)) - ;; We're now there, modulo comments and whitespace. - ;; Try to be line oriented; position point at the closest - ;; preceding boi that isn't inside a comment, but if we hit - ;; the previous declaration then we use the current point - ;; instead. - (while (and (/= (point) (c-point 'boi)) - (c-backward-single-comment))) - (if (/= (point) (c-point 'boi)) - (goto-char pos))) - - (c-keep-region-active) - (= arg 0)))))) + (c-save-buffer-state + (beginning-of-defun-function + end-of-defun-function + (start (point)) + (paren-state (c-parse-state)) + (orig-point-min (point-min)) (orig-point-max (point-max)) + lim ; Position of { which has been widened to. + where pos case-fold-search) + + (save-restriction + (if (eq c-defun-tactic 'go-outward) + (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace. + paren-state orig-point-min orig-point-max))) + + ;; Move back out of any macro/comment/string we happen to be in. + (c-beginning-of-macro) + (setq pos (c-literal-limits)) + (if pos (goto-char (car pos))) + + (setq where (c-where-wrt-brace-construct)) + + (if (< arg 0) + ;; Move forward to the closing brace of a function. + (progn + (if (memq where '(at-function-end outwith-function)) + (setq arg (1+ arg))) + (if (< arg 0) + (c-while-widening-to-decl-block + (< (setq arg (- (c-forward-to-nth-EOF-} (- arg) where))) 0))) + ;; Move forward to the next opening brace.... + (when (and (= arg 0) + (progn + (c-while-widening-to-decl-block + (not (c-syntactic-re-search-forward "{" nil 'eob))) + (eq (char-before) ?{))) + (backward-char) + ;; ... and backward to the function header. + (c-beginning-of-decl-1) + t)) + + ;; Move backward to the opening brace of a function, making successively + ;; larger portions of the buffer visible as necessary. + (when (> arg 0) + (c-while-widening-to-decl-block + (> (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))) + + (when (eq arg 0) + ;; Go backward to this function's header. + (c-beginning-of-decl-1) + + (setq pos (point)) + ;; We're now there, modulo comments and whitespace. + ;; Try to be line oriented; position point at the closest + ;; preceding boi that isn't inside a comment, but if we hit + ;; the previous declaration then we use the current point + ;; instead. + (while (and (/= (point) (c-point 'boi)) + (c-backward-single-comment))) + (if (/= (point) (c-point 'boi)) + (goto-char pos))) + + (c-keep-region-active) + (= arg 0))))) (defun c-forward-to-nth-EOF-} (n where) ;; Skip to the closing brace of the Nth function after point. If @@ -1719,68 +1718,66 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'." (c-region-is-active-p) (push-mark)) - (c-self-bind-state-cache ; c-state-cache's list structure must not be shared - ; with other users. - (c-save-buffer-state - (beginning-of-defun-function - end-of-defun-function - (start (point)) - (paren-state (c-parse-state)) - (orig-point-min (point-min)) (orig-point-max (point-max)) - lim - where pos case-fold-search) - - (save-restriction - (if (eq c-defun-tactic 'go-outward) - (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace - paren-state orig-point-min orig-point-max))) - - ;; Move back out of any macro/comment/string we happen to be in. - (c-beginning-of-macro) - (setq pos (c-literal-limits)) - (if pos (goto-char (car pos))) - - (setq where (c-where-wrt-brace-construct)) - - (if (< arg 0) - ;; Move backwards to the } of a function - (progn - (if (memq where '(at-header outwith-function)) - (setq arg (1+ arg))) - (if (< arg 0) - (c-while-widening-to-decl-block - (< (setq arg (- (c-backward-to-nth-BOF-{ (- arg) where))) 0))) - (if (= arg 0) - (c-while-widening-to-decl-block - (progn (c-syntactic-skip-backward "^}") - (not (eq (char-before) ?})))))) - - ;; Move forward to the } of a function - (if (> arg 0) - (c-while-widening-to-decl-block - (> (setq arg (c-forward-to-nth-EOF-} arg where)) 0)))) - - ;; Do we need to move forward from the brace to the semicolon? - (when (eq arg 0) - (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. - (c-syntactic-re-search-forward ";")) + (c-save-buffer-state + (beginning-of-defun-function + end-of-defun-function + (start (point)) + (paren-state (c-parse-state)) + (orig-point-min (point-min)) (orig-point-max (point-max)) + lim + where pos case-fold-search) - (setq pos (point)) - ;; We're there now, modulo comments and whitespace. - ;; Try to be line oriented; position point after the next - ;; newline that isn't inside a comment, but if we hit the - ;; next declaration then we use the current point instead. - (while (and (not (bolp)) - (not (looking-at "\\s *$")) - (c-forward-single-comment))) - (cond ((bolp)) - ((looking-at "\\s *$") - (forward-line 1)) - (t - (goto-char pos)))) + (save-restriction + (if (eq c-defun-tactic 'go-outward) + (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace + paren-state orig-point-min orig-point-max))) - (c-keep-region-active) - (= arg 0))))) + ;; Move back out of any macro/comment/string we happen to be in. + (c-beginning-of-macro) + (setq pos (c-literal-limits)) + (if pos (goto-char (car pos))) + + (setq where (c-where-wrt-brace-construct)) + + (if (< arg 0) + ;; Move backwards to the } of a function + (progn + (if (memq where '(at-header outwith-function)) + (setq arg (1+ arg))) + (if (< arg 0) + (c-while-widening-to-decl-block + (< (setq arg (- (c-backward-to-nth-BOF-{ (- arg) where))) 0))) + (if (= arg 0) + (c-while-widening-to-decl-block + (progn (c-syntactic-skip-backward "^}") + (not (eq (char-before) ?})))))) + + ;; Move forward to the } of a function + (if (> arg 0) + (c-while-widening-to-decl-block + (> (setq arg (c-forward-to-nth-EOF-} arg where)) 0)))) + + ;; Do we need to move forward from the brace to the semicolon? + (when (eq arg 0) + (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. + (c-syntactic-re-search-forward ";")) + + (setq pos (point)) + ;; We're there now, modulo comments and whitespace. + ;; Try to be line oriented; position point after the next + ;; newline that isn't inside a comment, but if we hit the + ;; next declaration then we use the current point instead. + (while (and (not (bolp)) + (not (looking-at "\\s *$")) + (c-forward-single-comment))) + (cond ((bolp)) + ((looking-at "\\s *$") + (forward-line 1)) + (t + (goto-char pos)))) + + (c-keep-region-active) + (= arg 0)))) (defun c-defun-name () "Return the name of the current defun, or NIL if there isn't one. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index f458904..4c78bc3 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1400,25 +1400,41 @@ been put there by c-put-char-property. POINT remains unchanged." (c-set-cpp-delimiters ,beg ,end))))) (defmacro c-self-bind-state-cache (&rest forms) - ;; Bind the state cache to itself and execute the FORMS. It is assumed that no - ;; buffer changes will happen in FORMS, and no hidden buffer changes which could - ;; affect the parsing will be made by FORMS. - `(let ((c-state-cache (copy-tree c-state-cache)) - (c-state-cache-good-pos c-state-cache-good-pos) - ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) - ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) - ;(c-state-semi-nonlit-pos-cache (copy-tree c-state-semi-nonlit-pos-cache)) - ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) - (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) - (c-state-point-min c-state-point-min) - (c-state-point-min-lit-type c-state-point-min-lit-type) - (c-state-point-min-lit-start c-state-point-min-lit-start) - (c-state-min-scan-pos c-state-min-scan-pos) - (c-state-old-cpp-beg c-state-old-cpp-beg) - (c-state-old-cpp-end c-state-old-cpp-end)) - ,@forms)) + ;; Bind the state cache to itself and execute the FORMS. Return the result + ;; of the last FORM executed. It is assumed that no buffer changes will + ;; happen in FORMS, and no hidden buffer changes which could affect the + ;; parsing will be made by FORMS. + `(let* ((c-state-cache (copy-tree c-state-cache)) + (c-state-cache-good-pos c-state-cache-good-pos) + ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) + ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) + ;(c-state-semi-nonlit-pos-cache (copy-tree c-state-semi-nonlit-pos-cache)) + ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) + (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) + (c-state-point-min c-state-point-min) + (c-state-point-min-lit-type c-state-point-min-lit-type) + (c-state-point-min-lit-start c-state-point-min-lit-start) + (c-state-min-scan-pos c-state-min-scan-pos) + (c-state-old-cpp-beg-marker (if (markerp c-state-old-cpp-beg-marker) + (copy-marker c-state-old-cpp-beg-marker) + c-state-old-cpp-beg-marker)) + (c-state-old-cpp-beg (if (markerp c-state-old-cpp-beg) + c-state-old-cpp-beg-marker + c-state-old-cpp-beg)) + (c-state-old-cpp-end-marker (if (markerp c-state-old-cpp-end-marker) + (copy-marker c-state-old-cpp-end-marker) + c-state-old-cpp-end-marker)) + (c-state-old-cpp-end (if (markerp c-state-old-cpp-end) + c-state-old-cpp-end-marker + c-state-old-cpp-end)) + (c-parse-state-state c-parse-state-state)) + (prog1 + (progn ,@forms) + (if (markerp c-state-old-cpp-beg-marker) + (move-marker c-state-old-cpp-beg-marker nil)) + (if (markerp c-state-old-cpp-end-marker) + (move-marker c-state-old-cpp-end-marker nil))))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The following macros are to be used only in `c-parse-state' and its ;; subroutines. Their main purpose is to simplify the handling of C++/Java diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index afe87c5..aac7e63 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -3472,6 +3472,9 @@ comment at the start of cc-engine.el for more info." (make-variable-buffer-local 'c-parse-state-state) (defun c-record-parse-state-state () (setq c-parse-state-point (point)) + (when (markerp (cdr (assq 'c-state-old-cpp-beg c-parse-state-state))) + (move-marker (cdr (assq 'c-state-old-cpp-beg c-parse-state-state)) nil) + (move-marker (cdr (assq 'c-state-old-cpp-end c-parse-state-state)) nil)) (setq c-parse-state-state (mapcar (lambda (arg)