diff options
author | Nickolas Lloyd <ultrageek.lloyd@gmail.com> | 2017-02-01 22:31:55 -0500 |
---|---|---|
committer | Nickolas Lloyd <ultrageek.lloyd@gmail.com> | 2017-02-01 22:31:55 -0500 |
commit | 9a15b5509abb49a11c97c1101ad216f4ef258368 (patch) | |
tree | 7311337d92833cb8f233eaa696a967a15a306a80 /lisp | |
parent | 5d8f2548ceaa5a0b33c08a39f1d6c11071ec63aa (diff) | |
parent | 70d36dda26465b43c1a63e8e13153e070af86456 (diff) | |
download | emacs-nick.lloyd-bytecode-jit.tar.gz |
Merge branch 'master' into nick.lloyd-bytecode-jitnick.lloyd-bytecode-jit
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/auth-source.el | 2 | ||||
-rw-r--r-- | lisp/calendar/parse-time.el | 12 | ||||
-rw-r--r-- | lisp/comint.el | 11 | ||||
-rw-r--r-- | lisp/emacs-lisp/debug.el | 54 | ||||
-rw-r--r-- | lisp/emacs-lisp/let-alist.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 5 | ||||
-rw-r--r-- | lisp/gnus/gnus-art.el | 7 | ||||
-rw-r--r-- | lisp/image-dired.el | 8 | ||||
-rw-r--r-- | lisp/net/tramp.el | 30 | ||||
-rw-r--r-- | lisp/progmodes/cc-align.el | 12 | ||||
-rw-r--r-- | lisp/progmodes/cc-engine.el | 101 | ||||
-rw-r--r-- | lisp/progmodes/cc-styles.el | 1 | ||||
-rw-r--r-- | lisp/progmodes/cc-vars.el | 2 | ||||
-rw-r--r-- | lisp/shell.el | 2 | ||||
-rw-r--r-- | lisp/vc/diff-mode.el | 26 |
15 files changed, 151 insertions, 124 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index c26935fcc97..7402ab21d74 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -2129,7 +2129,7 @@ MODE can be \"login\" or \"password\"." (if user (auth-source-search :host host - :user "yourusername" + :user user :max 1 :require '(:user :secret) :create nil) diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index 7651c5da1f4..b781cb0eb48 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el @@ -1,4 +1,4 @@ -;;; parse-time.el --- parsing time strings +;;; parse-time.el --- parsing time strings -*- lexical-binding: t -*- ;; Copyright (C) 1996, 2000-2017 Free Software Foundation, Inc. @@ -203,12 +203,9 @@ any values that are unknown are returned as nil." (time-second 2digit) (time-secfrac "\\(\\.[0-9]+\\)?") (time-numoffset (concat "\\([-+]\\)" time-hour ":?" time-minute "?")) - (time-offset (concat "Z" time-numoffset)) (partial-time (concat time-hour colon time-minute colon time-second time-secfrac)) - (full-date (concat date-fullyear dash date-month dash date-mday)) - (full-time (concat partial-time time-offset)) - (date-time (concat full-date "T" full-time))) + (full-date (concat date-fullyear dash date-month dash date-mday))) (list (concat "^" full-date) (concat "T" partial-time) (concat "\\(Z\\|" time-numoffset "\\)"))) @@ -225,7 +222,7 @@ If DATE-STRING cannot be parsed, it falls back to (time-re (nth 1 parse-time-iso8601-regexp)) (tz-re (nth 2 parse-time-iso8601-regexp)) re-start - time seconds minute hour fractional-seconds + time seconds minute hour day month year day-of-week dst tz) ;; We need to populate 'time' with ;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ) @@ -240,9 +237,6 @@ If DATE-STRING cannot be parsed, it falls back to (setq hour (string-to-number (match-string 1 date-string)) minute (string-to-number (match-string 2 date-string)) seconds (string-to-number (match-string 3 date-string)) - fractional-seconds (string-to-number (or - (match-string 4 date-string) - "0")) re-start (match-end 0)) (when (string-match tz-re date-string re-start) (if (string= "Z" (match-string 1 date-string)) diff --git a/lisp/comint.el b/lisp/comint.el index c82c3d09df3..830f4ca88f9 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1879,7 +1879,6 @@ Similarly for Soar, Scheme, etc." (let ((echo-len (- comint-last-input-end comint-last-input-start))) ;; Wait for all input to be echoed: - (while (and (> (+ comint-last-input-end echo-len) (point-max)) (accept-process-output proc) @@ -1891,7 +1890,6 @@ Similarly for Soar, Scheme, etc." ;; (+ comint-last-input-start ;; (- (point-max) comint-last-input-end)) nil comint-last-input-end (point-max))))) - (if (and (<= (+ comint-last-input-end echo-len) (point-max)) @@ -1903,7 +1901,6 @@ Similarly for Soar, Scheme, etc." ;; Certain parts of the text to be deleted may have ;; been mistaken for prompts. We have to prevent ;; problems when `comint-prompt-read-only' is non-nil. - (let ((inhibit-read-only t)) (delete-region comint-last-input-end (+ comint-last-input-end echo-len)) @@ -1912,7 +1909,6 @@ Similarly for Soar, Scheme, etc." (goto-char comint-last-input-end) (comint-update-fence))))))) - ;; This used to call comint-output-filter-functions, ;; but that scrolled the buffer in undesirable ways. (run-hook-with-args 'comint-output-filter-functions ""))))) @@ -2243,7 +2239,10 @@ the current line with any initial string matching the regexp (null (get-char-property (setq bof (field-beginning)) 'field))) (field-string-no-properties bof) (comint-bol) - (buffer-substring-no-properties (point) (line-end-position))))) + (buffer-substring-no-properties (point) + (if comint-use-prompt-regexp + (line-end-position) + (field-end)))))) (defun comint-copy-old-input () "Insert after prompt old input at point as new input to be edited. @@ -2670,7 +2669,7 @@ This command is like `M-.' in bash." (set-marker comint-insert-previous-argument-last-start-pos (point)) ;; Insert the argument. (let ((input-string (comint-previous-input-string 0))) - (when (string-match "[ \t\n]*&[ \t\n]*$" input-string) + (when (string-match "[ \t\n]*&" input-string) ;; strip terminating '&' (setq input-string (substring input-string 0 (match-beginning 0)))) (insert (comint-arguments input-string index index))) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index faa323f733a..cb77148c285 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -816,60 +816,6 @@ Redefining FUNCTION also cancels it." '((depth . -100))) function) -;;;###autoload -;; (defun debug-on-set (symbol) -;; "Request FUNCTION to invoke debugger each time it is called. - -;; When called interactively, prompt for FUNCTION in the minibuffer. - -;; This works by modifying the definition of FUNCTION. If you tell the -;; debugger to continue, FUNCTION's execution proceeds. If FUNCTION is a -;; normal function or a macro written in Lisp, you can also step through -;; its execution. FUNCTION can also be a primitive that is not a special -;; form, in which case stepping is not possible. Break-on-entry for -;; primitive functions only works when that function is called from Lisp. - -;; Use \\[cancel-debug-on-entry] to cancel the effect of this command. -;; Redefining FUNCTION also cancels it." -;; (interactive -;; (let ((v (variable-at-point)) -;; (enable-recursive-minibuffers t) -;; (orig-buffer (current-buffer)) -;; val) -;; (setq val (completing-read -;; (if (symbolp v) -;; (format -;; "Debug on set to symbol (default %s): " v) -;; "Debug on set to symbol: ") -;; #'help--symbol-completion-table -;; (lambda (vv) -;; ;; In case the variable only exists in the buffer -;; ;; the command we switch back to that buffer before -;; ;; we examine the variable. -;; (with-current-buffer orig-buffer -;; (or (get vv 'variable-documentation) -;; (and (boundp vv) (not (keywordp vv)))))) -;; t nil nil -;; (if (symbolp v) (symbol-name v)))) -;; (list (if (equal val "") -;; v (intern val))))) - - - -;; (interactive -;; (let* ((var-default (variable-at-point)) -;; (var (completing-read -;; (if var-default -;; (format "Debug on set to symbol (default %s): " var-default) -;; "Debug on set to symbol: ") -;; nil -;; #'boundp -;; t nil nil (symbol-name var-default)))) -;; (list (if (equal var "") var-default (intern var))))) -;; (advice-add function :before #'debug--implement-debug-on-entry -;; '((depth . -100))) -;; function) - (defun debug--function-list () "List of functions currently set for debug on entry." (let ((funs '())) diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el index a45fc0a05c3..cf82fe3ec63 100644 --- a/lisp/emacs-lisp/let-alist.el +++ b/lisp/emacs-lisp/let-alist.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba <emacs@endlessparentheses.com> ;; Package-Requires: ((emacs "24.1")) -;; Version: 1.0.4 +;; Version: 1.0.5 ;; Keywords: extensions lisp ;; Prefix: let-alist ;; Separator: - diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 7736225b5fa..52331b9ad36 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -214,6 +214,11 @@ user enters `recenter', `scroll-up', or `scroll-down' responses, perform the requested window recentering or scrolling and ask again. +When `use-dialog-box' is t (the default), this function can pop +up a dialog window to collect the user input. That functionality +requires `display-popup-menus-p' to return t. Otherwise, a text +dialog will be used. + The return value is the matching entry from the CHOICES list. Usage example: diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 43e1231914c..a4ff840f755 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -1713,9 +1713,10 @@ regexp." ;; (modify-syntax-entry ?- "w" table) (modify-syntax-entry ?> ")<" table) (modify-syntax-entry ?< "(>" table) - ;; make M-. in article buffers work for `foo' strings - (modify-syntax-entry ?' " " table) - (modify-syntax-entry ?` " " table) + ;; make M-. in article buffers work for `foo' strings, + ;; and still allow C-s C-w to yank ' to the search ring + (modify-syntax-entry ?' "'" table) + (modify-syntax-entry ?` "'" table) table) "Syntax table used in article mode buffers. Initialized from `text-mode-syntax-table'.") diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 901225fa2e9..2a4064560a7 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -94,6 +94,7 @@ ;; * WARNING: The "database" format used might be changed so keep a ;; backup of `image-dired-db-file' when testing new versions. ;; +;; * `image-dired-display-image-mode' does not support animation ;; ;; TODO ;; ==== @@ -228,7 +229,7 @@ Used together with `image-dired-cmd-create-thumbnail-options'." :group 'image-dired) (defcustom image-dired-cmd-create-thumbnail-options - '("-size" "%wx%h" "%f" "-resize" "%wx%h>" "-strip" "jpeg:%t") + '("-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t") "Options of command used to create thumbnail image. Used with `image-dired-cmd-create-thumbnail-program'. Available format specifiers are: %w which is replaced by @@ -246,7 +247,7 @@ Used together with `image-dired-cmd-create-temp-image-options'." :group 'image-dired) (defcustom image-dired-cmd-create-temp-image-options - '("-size" "%wx%h" "%f" "-resize" "%wx%h>" "-strip" "jpeg:%t") + '("-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t") "Options of command used to create temporary image for display window. Used together with `image-dired-cmd-create-temp-image-program', Available format specifiers are: %w and %h which are replaced by @@ -316,7 +317,7 @@ Available format specifiers are described in :group 'image-dired) (defcustom image-dired-cmd-create-standard-thumbnail-options - (append '("-size" "%wx%h" "%f") + (append '("-size" "%wx%h" "%f[0]") (unless (or image-dired-cmd-pngcrush-program image-dired-cmd-pngnq-program) (list @@ -1626,6 +1627,7 @@ Resized or in full-size." :group 'image-dired (buffer-disable-undo) (image-mode-setup-winprops) + (setq cursor-type nil) (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) (defvar image-dired-minor-mode-map diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fc7fdd30850..48dcd5edd11 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3614,18 +3614,36 @@ connection buffer." ;;; Utility functions: -(defun tramp-accept-process-output (&optional proc timeout timeout-msecs) +(defun tramp-accept-process-output (proc timeout) "Like `accept-process-output' for Tramp processes. This is needed in order to hide `last-coding-system-used', which is set for process communication also." + ;; FIXME: There are problems, when an asynchronous process runs in + ;; parallel, and also timers are active. See + ;; <http://lists.gnu.org/archive/html/tramp-devel/2017-01/msg00010.html>. + (when (and timer-event-last + (string-prefix-p "*tramp/" (process-name proc)) + (let (result) + (maphash + (lambda (key _value) + (and (processp key) + (not (string-prefix-p "*tramp/" (process-name key))) + (tramp-compat-process-live-p key) + (setq result t))) + tramp-cache-data) + result)) + (sit-for 0.01 'nodisp)) (with-current-buffer (process-buffer proc) (let (buffer-read-only last-coding-system-used) ;; Under Windows XP, accept-process-output doesn't return - ;; sometimes. So we add an additional timeout. - (with-timeout ((or timeout 1)) - (accept-process-output proc timeout timeout-msecs (and proc t))) - (tramp-message proc 10 "%s %s\n%s" - proc (process-status proc) (buffer-string))))) + ;; sometimes. So we add an additional timeout. JUST-THIS-ONE + ;; is set due to Bug#12145. + (tramp-message + proc 10 "%s %s %s\n%s" + proc (process-status proc) + (with-timeout (timeout) + (accept-process-output proc timeout nil t)) + (buffer-string))))) (defun tramp-check-for-regexp (proc regexp) "Check, whether REGEXP is contained in process buffer of PROC. diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 7cb36c4396b..0f7e4b598dc 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -1221,6 +1221,18 @@ Works with: arglist-cont, arglist-cont-nonempty." (vector (progn (goto-char alignto) (current-column))))))) +(defun c-lineup-under-anchor (langelem) + "Line up the current line directly under the anchor position in LANGELEM. + +This is like 0, except it supersedes any indentation already calculated for +previous syntactic elements in the syntactic context. + +Works with: Any syntactic symbol which has an anchor position." + (save-excursion + (goto-char (c-langelem-pos langelem)) + (vector (current-column)))) + + (defun c-lineup-dont-change (langelem) "Do not change the indentation of the current line. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index fd7aa50840f..dfd7aebd569 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10260,13 +10260,22 @@ comment at the start of cc-engine.el for more info." (t nil))))) (setq pos (point)) - (if (and after-type-id-pos - (goto-char after-type-id-pos) - (setq res (c-back-over-member-initializers)) - (goto-char res) - (eq (car (c-beginning-of-decl-1 lim)) 'same)) - (cons (point) nil) ; Return value. - + (cond + ((and after-type-id-pos + (goto-char after-type-id-pos) + (setq res (c-back-over-member-initializers)) + (goto-char res) + (eq (car (c-beginning-of-decl-1 lim)) 'same)) + (cons (point) nil)) ; Return value. + + ((and after-type-id-pos + (progn + (c-backward-syntactic-ws) + (eq (char-before) ?\())) + ;; Single identifier between '(' and '{'. We have a bracelist. + (cons after-type-id-pos nil)) + + (t (goto-char pos) ;; Checks to do on all sexps before the brace, up to the ;; beginning of the statement. @@ -10368,7 +10377,7 @@ comment at the start of cc-engine.el for more info." ; languages where ; `c-opt-inexpr-brace-list-key' is ; non-nil and we have macros. - (t t))) ;; The caller can go up one level. + (t t)))) ;; The caller can go up one level. ))) (defun c-inside-bracelist-p (containing-sexp paren-state) @@ -10493,6 +10502,30 @@ comment at the start of cc-engine.el for more info." (c-at-statement-start-p)) (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1") +(defun c-looking-at-statement-block () + ;; Point is at an opening brace. If this is a statement block (i.e. the + ;; elements in it are terminated by semicolons) return t. Otherwise, return + ;; nil. + (let ((here (point))) + (prog1 + (if (c-go-list-forward) + (let ((there (point))) + (backward-char) + (c-syntactic-skip-backward + "^;," here t) + (cond + ((eq (char-before) ?\;) t) + ((eq (char-before) ?,) nil) + (t (goto-char here) + (forward-char) + (and (c-syntactic-re-search-forward "{" there t t) + (progn (backward-char) + (c-looking-at-statement-block)))))) + (forward-char) + (and (c-syntactic-re-search-forward "[;,]" nil t t) + (eq (char-before) ?\;))) + (goto-char here)))) + (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) ;; Return non-nil if we're looking at the beginning of a block ;; inside an expression. The value returned is actually a cons of @@ -10648,15 +10681,7 @@ comment at the start of cc-engine.el for more info." (and (c-major-mode-is 'c++-mode) (save-excursion (goto-char block-follows) - (if (c-go-list-forward) - (progn - (backward-char) - (c-syntactic-skip-backward - "^;," block-follows t) - (not (eq (char-before) ?\;))) - (or (not (c-syntactic-re-search-forward - "[;,]" nil t t)) - (not (eq (char-before) ?\;))))))) + (not (c-looking-at-statement-block))))) nil (cons 'inexpr-statement (point))))) @@ -10792,17 +10817,20 @@ comment at the start of cc-engine.el for more info." syntax-extra-args stop-at-boi-only containing-sexp - paren-state) + paren-state + &optional fixed-anchor) ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as ;; needed with further syntax elements of the types `substatement', - ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and - ;; `defun-block-intro'. + ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', + ;; `defun-block-intro', and `brace-list-intro'. ;; - ;; Do the generic processing to anchor the given syntax symbol on - ;; the preceding statement: Skip over any labels and containing - ;; statements on the same line, and then search backward until we - ;; find a statement or block start that begins at boi without a - ;; label or comment. + ;; Do the generic processing to anchor the given syntax symbol on the + ;; preceding statement: First skip over any labels and containing statements + ;; on the same line. If FIXED-ANCHOR is non-nil, use this as the + ;; anchor-point for the given syntactic symbol, and don't make syntactic + ;; entries for constructs beginning on lines before that containing + ;; ANCHOR-POINT. Otherwise search backward until we find a statement or + ;; block start that begins at boi without a label or comment. ;; ;; Point is assumed to be at the prospective anchor point for the ;; given SYNTAX-SYMBOL. More syntax entries are added if we need to @@ -10831,6 +10859,7 @@ comment at the start of cc-engine.el for more info." (let ((syntax-last c-syntactic-context) (boi (c-point 'boi)) + (anchor-boi (c-point 'boi)) ;; Set when we're on a label, so that we don't stop there. ;; FIXME: To be complete we should check if we're on a label ;; now at the start. @@ -10908,7 +10937,9 @@ comment at the start of cc-engine.el for more info." (c-add-syntax 'substatement nil)))) ))) - containing-sexp) + containing-sexp + (or (null fixed-anchor) + (> containing-sexp anchor-boi))) ;; Now we have to go out of this block. (goto-char containing-sexp) @@ -10982,6 +11013,14 @@ comment at the start of cc-engine.el for more info." (cdr (assoc (match-string 1) c-other-decl-block-key-in-symbols-alist)) (max (c-point 'boi paren-pos) (point)))) + ((save-excursion + (goto-char paren-pos) + (c-looking-at-or-maybe-in-bracelist containing-sexp)) + (if (save-excursion + (goto-char paren-pos) + (c-looking-at-statement-block)) + (c-add-syntax 'defun-block-intro nil) + (c-add-syntax 'brace-list-intro nil))) (t (c-add-syntax 'defun-block-intro nil)))) (c-add-syntax 'statement-block-intro nil))) @@ -11001,7 +11040,10 @@ comment at the start of cc-engine.el for more info." (setq q (cdr (car p))) ; e.g. (nil 28) [from (arglist-cont-nonempty nil 28)] (while q (unless (car q) - (setcar q (point))) + (setcar q (if (or (cdr p) + (null fixed-anchor)) + (point) + fixed-anchor))) (setq q (cdr q))) (setq p (cdr p)))) ))) @@ -12354,7 +12396,8 @@ comment at the start of cc-engine.el for more info." (c-forward-syntactic-ws (c-point 'eol)) (c-looking-at-special-brace-list (point))))) (c-add-syntax 'brace-entry-open (point)) - (c-add-syntax 'brace-list-entry (point)) + (c-add-stmt-syntax 'brace-list-entry nil t containing-sexp + paren-state (point)) )) )))) @@ -12848,7 +12891,7 @@ Cannot combine absolute offsets %S and %S in `add' method" ;; ;; Note that topmost-intro always has an anchor position at bol, for ;; historical reasons. It's often used together with other symbols - ;; that has more sane positions. Since we always use the first + ;; that have more sane positions. Since we always use the first ;; found anchor position, we rely on that these other symbols always ;; precede topmost-intro in the LANGELEMS list. ;; diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index d3505490505..b3848a74f97 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el @@ -67,6 +67,7 @@ (arglist-close . c-lineup-arglist) (inline-open . 0) (brace-list-open . +) + (brace-list-intro . c-lineup-arglist-intro-after-paren) (topmost-intro-cont . (first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont)))) diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index a6a96d15188..1114b21381d 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1115,7 +1115,7 @@ can always override the use of `c-default-style' by making calls to ;; Anchor pos: At the brace list decl start(*). (brace-list-intro . +) ;; Anchor pos: At the brace list decl start(*). - (brace-list-entry . 0) + (brace-list-entry . c-lineup-under-anchor) ;; Anchor pos: At the first non-ws char after the open paren if ;; the first token is on the same line, otherwise boi at that ;; token. diff --git a/lisp/shell.el b/lisp/shell.el index c7ba64ecf4e..c8a8555d632 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1000,8 +1000,6 @@ command again." (let ((pt (point)) (regexp (concat - ;; comint-process-echoes is the thing that breaks the - ;; throbber (if comint-process-echoes ;; Skip command echo if the process echoes (concat "\\(" (regexp-quote shell-dirstack-query) "\n\\)") diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index e609ca9f943..7ffa115bde4 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -437,6 +437,9 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html") (defconst diff-hunk-header-re (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")) (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1))) + +(defconst diff-separator-re "^--+ ?$") + (defvar diff-narrowed-to nil) (defun diff-hunk-style (&optional style) @@ -1537,15 +1540,20 @@ Only works for unified diffs." (pcase (char-after) (?\s (cl-decf before) (cl-decf after) t) (?- - (if (and (looking-at diff-file-header-re) - (zerop before) (zerop after)) - ;; No need to query: this is a case where two patches - ;; are concatenated and only counting the lines will - ;; give the right result. Let's just add an empty - ;; line so that our code which doesn't count lines - ;; will not get confused. - (progn (save-excursion (insert "\n")) nil) - (cl-decf before) t)) + (cond + ((and (looking-at diff-separator-re) + (zerop before) (zerop after)) + nil) + ((and (looking-at diff-file-header-re) + (zerop before) (zerop after)) + ;; No need to query: this is a case where two patches + ;; are concatenated and only counting the lines will + ;; give the right result. Let's just add an empty + ;; line so that our code which doesn't count lines + ;; will not get confused. + (save-excursion (insert "\n")) nil) + (t + (cl-decf before) t))) (?+ (cl-decf after) t) (_ (cond |