diff options
| author | Glenn Morris <rgm@gnu.org> | 2012-11-23 17:57:09 -0800 |
|---|---|---|
| committer | Glenn Morris <rgm@gnu.org> | 2012-11-23 17:57:09 -0800 |
| commit | d125ca15f3751f36a1ec49e3d9f9de1735b43698 (patch) | |
| tree | 5d2764d6a135cdd7d664c8c43f915a14932cd94c /lisp | |
| parent | 678a34f4f8e93b8c43e5cdfba423189f4767e5c5 (diff) | |
| parent | 6d4e8f62e93b575a1da2cd2b4abeb9dce56e1e52 (diff) | |
| download | emacs-d125ca15f3751f36a1ec49e3d9f9de1735b43698.tar.gz | |
Merge from emacs-24; up to 2012-11-19T11:36:02Z!yamaoka@jpl.org
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 52 | ||||
| -rw-r--r-- | lisp/dired.el | 18 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 3 | ||||
| -rw-r--r-- | lisp/faces.el | 36 | ||||
| -rw-r--r-- | lisp/image-mode.el | 10 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 53 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 7 | ||||
| -rw-r--r-- | lisp/wdired.el | 30 |
9 files changed, 162 insertions, 49 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 09f42233f96..c127bfd42e6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,55 @@ +2012-11-24 Stefan Monnier <monnier@iro.umontreal.ca> + + * emacs-lisp/bytecomp.el (byte-compile-file): Setup default value for + lexical-binding (bug#12938). + +2012-11-24 Wolfgang Jenkner <wjenkner@inode.at> + + * image-mode.el (image-transform-check-size): Use assertions only + for images of type imagemagick. + + Otherwise no error, image-transform-fit-to-{width,height} is + silently ignored, as before. Doc fix. + +2012-11-24 Chong Yidong <cyd@gnu.org> + + * faces.el (color-defined-p): Doc fix (Bug#12853). + +2012-11-24 Juri Linkov <juri@jurta.org> + + * dired.el (dired-mark): Add optional arg `interactive'. + Check for `use-region-p' if `interactive' is non-nil. + (dired-unmark, dired-flag-file-deletion): Add optional arg + `interactive'. Call `dired-mark' with the arg `interactive'. + (Bug#10624) + + * wdired.el: Revert 2012-10-17 change partly and replace it with + Patch by Christopher Schmidt <christopher@ch.ristopher.com>. + (wdired-finish-edit): Add marks for new file names to + `wdired-old-marks'. Restore marks using `dired-mark-remembered' + after `revert-buffer'. + (wdired-do-renames): Remove calls to `dired-remove-file', + `dired-add-file', `dired-add-entry'. (Bug#11795) + +2012-11-24 Alan Mackenzie <acm@muc.de> + + * progmodes/cc-defs.el (c-version): Bump to 5.32.4. + + Fix bugs in the state cache. Enhance a debugging mechanism. + * progmodes/cc-engine.el (c-parse-state-get-strategy): Don't use + "brace at column zero" strategy for C++. + (c-append-lower-brace-pair-to-state-cache): Repair algorithm. + (c-parse-state-point): New variable. + (c-record-parse-state-state): Record old parse state with + `copy-tree'. Record previous value of point. + (c-debug-parse-state-double-cons): New debugging function. + (c-debug-parse-state): Call the above new function. + (c-toggle-parse-state-debug): Output a confirmatory message. + + * progmodes/cc-mode.el (c-before-change, c-after-change): + Call c-invalidate-state-cache from `c-before-change' instead of + `c-after-change'. + 2012-11-23 Chong Yidong <cyd@gnu.org> * find-cmd.el (find-constituents): Add executable, ipath, diff --git a/lisp/dired.el b/lisp/dired.el index f6056e20d0a..1d6c667e1dd 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3109,7 +3109,7 @@ argument or confirmation)." (insert dired-marker-char))) (forward-line 1)))) -(defun dired-mark (arg) +(defun dired-mark (arg &optional interactive) "Mark the file at point in the Dired buffer. If the region is active, mark all files in the region. Otherwise, with a prefix arg, mark files on the next ARG lines. @@ -3119,10 +3119,10 @@ If on a subdir headerline, mark all its files except `.' and `..'. Use \\[dired-unmark-all-files] to remove all marks and \\[dired-unmark] on a subdir to remove the marks in this subdir." - (interactive "P") + (interactive (list current-prefix-arg t)) (cond ;; Mark files in the active region. - ((and transient-mark-mode mark-active) + ((and interactive (use-region-p)) (save-excursion (let ((beg (region-beginning)) (end (region-end))) @@ -3139,7 +3139,7 @@ this subdir." (prefix-numeric-value arg) (function (lambda () (delete-char 1) (insert dired-marker-char)))))))) -(defun dired-unmark (arg) +(defun dired-unmark (arg &optional interactive) "Unmark the file at point in the Dired buffer. If the region is active, unmark all files in the region. Otherwise, with a prefix arg, unmark files on the next ARG lines. @@ -3147,11 +3147,11 @@ Otherwise, with a prefix arg, unmark files on the next ARG lines. If looking at a subdir, unmark all its files except `.' and `..'. If the region is active in Transient Mark mode, unmark all files in the active region." - (interactive "P") + (interactive (list current-prefix-arg t)) (let ((dired-marker-char ?\040)) - (dired-mark arg))) + (dired-mark arg interactive))) -(defun dired-flag-file-deletion (arg) +(defun dired-flag-file-deletion (arg &optional interactive) "In Dired, flag the current line's file for deletion. If the region is active, flag all files in the region. Otherwise, with a prefix arg, flag files on the next ARG lines. @@ -3159,9 +3159,9 @@ Otherwise, with a prefix arg, flag files on the next ARG lines. If on a subdir headerline, flag all its files except `.' and `..'. If the region is active in Transient Mark mode, flag all files in the active region." - (interactive "P") + (interactive (list current-prefix-arg t)) (let ((dired-marker-char dired-del-marker)) - (dired-mark arg))) + (dired-mark arg interactive))) (defun dired-unmark-backward (arg) "In Dired, move up lines and remove marks or deletion flags there. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 60036c86dc0..5867cfb7064 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1748,6 +1748,9 @@ The value is non-nil if there were no errors, nil if errors." ;; There may be a file local variable setting (bug#10419). (setq buffer-read-only nil filename buffer-file-name)) + ;; Don't inherit lexical-binding from caller (bug#12938). + (unless (local-variable-p 'lexical-binding) + (setq-local lexical-binding nil)) ;; Set the default directory, in case an eval-when-compile uses it. (setq default-directory (file-name-directory filename))) ;; Check if the file's local variables explicitly specify not to diff --git a/lisp/faces.el b/lisp/faces.el index f8dc4783cbb..928174c3954 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -929,13 +929,25 @@ of the default face. Value is FACE." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun read-face-name (prompt &optional default multiple) - "Read a face, defaulting to the face or faces on the char after point. -If it has the property `read-face-name', that overrides the `face' property. -PROMPT should be a string that describes what the caller will do with the face; -it should not end in a space. + "Read a face, defaulting to the face or faces at point. +If the text at point has the property `read-face-name', that +overrides the `face' property for determining the default. + +PROMPT should be a string that describes what the caller will do +with the face; it should not end in a space. + + +This function uses `completing-read-multiple' with \",\" as the +separator character, i.e. + + + + + The optional argument DEFAULT provides the value to display in the minibuffer prompt that is returned if the user just types RET unless DEFAULT is a string (in which case nil is returned). + If MULTIPLE is non-nil, return a list of faces (possibly only one). Otherwise, return a single face." (let ((faceprop (or (get-char-property (point) 'read-face-name) @@ -1692,12 +1704,16 @@ If FRAME is nil, that stands for the selected frame." (declare-function xw-color-defined-p "xfns.c" (color &optional frame)) (defun color-defined-p (color &optional frame) - "Return non-nil if color COLOR is supported on frame FRAME. -If FRAME is omitted or nil, use the selected frame. -If COLOR is the symbol `unspecified' or one of the strings -\"unspecified-fg\" or \"unspecified-bg\", the value is nil." - (if (member color '(unspecified "unspecified-bg" "unspecified-fg")) - nil + "Return non-nil if COLOR is supported on frame FRAME. +COLOR should be a string naming a color (e.g. \"white\"), or a +string specifying a color's RGB components (e.g. \"#ff12ec\"), or +the symbol `unspecified'. + +This function returns nil if COLOR is the symbol `unspecified', +or one of the strings \"unspecified-fg\" or \"unspecified-bg\". + +If FRAME is omitted or nil, use the selected frame." + (unless (member color '(unspecified "unspecified-bg" "unspecified-fg")) (if (member (framep (or frame (selected-frame))) '(x w32 ns)) (xw-color-defined-p color frame) (numberp (tty-color-translate color frame))))) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 4ac62fbb6fc..0e91567a29a 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -746,8 +746,14 @@ close to a multiple of 90, see `image-transform-right-angle-fudge'." h))))) (defun image-transform-check-size () - "Check that the image exactly fits the width/height of the window." - (unless (numberp image-transform-resize) + "Check that the image exactly fits the width/height of the window. + +Do this for an image of type `imagemagick' to make sure that the +elisp code matches the way ImageMagick computes the bounding box +of a rotated image." + (when (and (not (numberp image-transform-resize)) + (boundp 'image-type) + (eq image-type 'imagemagick)) (let ((size (image-display-size (image-get-display-property) t))) (cond ((eq image-transform-resize 'fit-width) (cl-assert (= (car size) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 0dc596a472b..17bd2760baa 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -93,7 +93,7 @@ ;;; Variables also used at compile time. -(defconst c-version "5.32.3" +(defconst c-version "5.32.4" "CC Mode version number.") (defconst c-version-sym (intern c-version)) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 2aa04cb2b0b..10355451480 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -2561,8 +2561,11 @@ comment at the start of cc-engine.el for more info." start-point cache-pos))) ;; Might we be better off starting from the top level, two defuns back, - ;; instead? - (when (> how-far c-state-cache-too-far) + ;; instead? This heuristic no longer works well in C++, where + ;; declarations inside namespace brace blocks are frequently placed at + ;; column zero. + (when (and (not (c-major-mode-is 'c++-mode)) + (> how-far c-state-cache-too-far)) (setq BOD-pos (c-get-fallback-scan-pos here)) ; somewhat EXPENSIVE!!! (if (< (- here BOD-pos) how-far) (setq strategy 'BOD @@ -2649,17 +2652,20 @@ comment at the start of cc-engine.el for more info." ;; If we're essentially repeating a fruitless search, just give up. (unless (and c-state-brace-pair-desert (eq cache-pos (car c-state-brace-pair-desert)) + (or (null (car c-state-brace-pair-desert)) + (> from (car c-state-brace-pair-desert))) (<= from (cdr c-state-brace-pair-desert))) - ;; DESERT-LIM. Only search what we absolutely need to, + ;; DESERT-LIM. Avoid repeated searching through the cached desert. (let ((desert-lim (and c-state-brace-pair-desert (eq cache-pos (car c-state-brace-pair-desert)) + (>= from (cdr c-state-brace-pair-desert)) (cdr c-state-brace-pair-desert))) ;; CACHE-LIM. This limit will be necessary when an opening ;; paren at `cache-pos' has just had its matching close paren - ;; inserted. `cache-pos' continues to be a search bound, even - ;; though the algorithm below would skip over the new paren - ;; pair. + ;; inserted into the buffer. `cache-pos' continues to be a + ;; search bound, even though the algorithm below would skip + ;; over the new paren pair. (cache-lim (and cache-pos (< cache-pos from) cache-pos))) (narrow-to-region (cond @@ -3342,12 +3348,18 @@ comment at the start of cc-engine.el for more info." (fset 'c-real-parse-state (symbol-function 'c-parse-state))) (cc-bytecomp-defun c-real-parse-state) +(defvar c-parse-state-point nil) (defvar c-parse-state-state nil) (defun c-record-parse-state-state () + (setq c-parse-state-point (point)) (setq c-parse-state-state (mapcar (lambda (arg) - (cons arg (symbol-value arg))) + (let ((val (symbol-value arg))) + (cons arg + (if (consp val) + (copy-tree val) + val)))) '(c-state-cache c-state-cache-good-pos c-state-nonlit-pos-cache @@ -3360,7 +3372,8 @@ comment at the start of cc-engine.el for more info." c-state-point-min-lit-start c-state-min-scan-pos c-state-old-cpp-beg - c-state-old-cpp-end)))) + c-state-old-cpp-end + c-parse-state-point)))) (defun c-replay-parse-state-state () (message (concat "(setq " @@ -3370,6 +3383,16 @@ comment at the start of cc-engine.el for more info." c-parse-state-state " ") ")"))) +(defun c-debug-parse-state-double-cons (state) + (let (state-car conses-not-ok) + (while state + (setq state-car (car state) + state (cdr state)) + (if (and (consp state-car) + (consp (car state))) + (setq conses-not-ok t))) + conses-not-ok)) + (defun c-debug-parse-state () (let ((here (point)) (res1 (c-real-parse-state)) res2) (let ((c-state-cache nil) @@ -3402,8 +3425,16 @@ comment at the start of cc-engine.el for more info." here res1 res2) (message "Old state:") (c-replay-parse-state-state)) + + (when (c-debug-parse-state-double-cons res1) + (message "c-parse-state INVALIDITY at %s: %s" + here res1) + (message "Old state:") + (c-replay-parse-state-state)) + (c-record-parse-state-state) - res1)) + res2 ; res1 correct a cascading series of errors ASAP + )) (defun c-toggle-parse-state-debug (&optional arg) (interactive "P") @@ -3411,7 +3442,9 @@ comment at the start of cc-engine.el for more info." (fset 'c-parse-state (symbol-function (if c-debug-parse-state 'c-debug-parse-state 'c-real-parse-state))) - (c-keep-region-active)) + (c-keep-region-active) + (message "c-debug-parse-state %sabled" + (if c-debug-parse-state "en" "dis"))) (when c-debug-parse-state (c-toggle-parse-state-debug 1)) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 50eaebe4dec..91866278e28 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1034,7 +1034,10 @@ Note that the style variables are always made local to the buffer." (mapc (lambda (fn) (funcall fn beg end)) c-get-state-before-change-functions)) - )))) + ))) + ;; The following must be done here rather than in `c-after-change' because + ;; newly inserted parens would foul up the invalidation algorithm. + (c-invalidate-state-cache beg)) (defvar c-in-after-change-fontification nil) (make-variable-buffer-local 'c-in-after-change-fontification) @@ -1082,7 +1085,7 @@ Note that the style variables are always made local to the buffer." (c-trim-found-types beg end old-len) ; maybe we don't need all of these. (c-invalidate-sws-region-after beg end) - (c-invalidate-state-cache beg) + ;; (c-invalidate-state-cache beg) ; moved to `c-before-change'. (c-invalidate-find-decl-cache beg) (when c-recognize-<>-arglists diff --git a/lisp/wdired.el b/lisp/wdired.el index 9851b2046d9..5183b5639c3 100644 --- a/lisp/wdired.el +++ b/lisp/wdired.el @@ -399,6 +399,15 @@ non-nil means return old filename." (setq changes t) (if (not file-new) ;empty filename! (push file-old files-deleted) + (when wdired-keep-marker-rename + (let ((mark (cond ((integerp wdired-keep-marker-rename) + wdired-keep-marker-rename) + (wdired-keep-marker-rename + (cdr (assoc file-old wdired-old-marks))) + (t nil)))) + (when mark + (push (cons (substitute-in-file-name file-new) mark) + wdired-old-marks)))) (push (cons file-old (substitute-in-file-name file-new)) files-renamed)))) (forward-line -1))) @@ -416,7 +425,9 @@ non-nil means return old filename." (= (length files-renamed) 1)) (setq dired-directory (cdr (car files-renamed)))) ;; Re-sort the buffer. - (revert-buffer)) + (revert-buffer) + (let ((inhibit-read-only t)) + (dired-mark-remembered wdired-old-marks))) (let ((inhibit-read-only t)) (remove-text-properties (point-min) (point-max) '(old-name nil end-name nil old-link nil @@ -430,8 +441,6 @@ non-nil means return old filename." (set-buffer-modified-p nil) (setq buffer-undo-list nil)) -(declare-function dired-add-entry "dired-aux" (filename &optional marker-char relative)) - (defun wdired-do-renames (renames) "Perform RENAMES in parallel." (let ((residue ()) @@ -473,8 +482,7 @@ non-nil means return old filename." (push (cons tmp file-new) residue)))) (t (setq progress t) - (let* ((file-ori (car rename)) - (old-mark (cdr (assoc file-ori wdired-old-marks)))) + (let ((file-ori (car rename))) (if wdired-use-interactive-rename (wdired-search-and-rename file-ori file-new) ;; If dired-rename-file autoloads dired-aux while @@ -485,20 +493,12 @@ non-nil means return old filename." (condition-case err (let ((dired-backup-overwrite nil)) (dired-rename-file file-ori file-new - overwrite) - (dired-remove-file file-ori) - (dired-add-file - file-new - (cond ((integerp wdired-keep-marker-rename) - wdired-keep-marker-rename) - (wdired-keep-marker-rename old-mark) - (t nil)))) + overwrite)) (error (setq errors (1+ errors)) (dired-log (concat "Rename `" file-ori "' to `" file-new "' failed:\n%s\n") - err) - (dired-add-entry file-ori old-mark))))))))) + err))))))))) errors)) |
