aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/bindings.el2
-rw-r--r--lisp/gnus/mm-uu.el18
-rw-r--r--lisp/image.el2
-rw-r--r--lisp/progmodes/grep.el46
-rw-r--r--lisp/vc/vc.el2
5 files changed, 44 insertions, 26 deletions
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 60823445b97..6ef8ffb0933 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -619,7 +619,7 @@ Switch to the most recently selected buffer other than the current one."
619 :button (:toggle . (bound-and-true-p flyspell-mode)))) 619 :button (:toggle . (bound-and-true-p flyspell-mode))))
620(bindings--define-key mode-line-mode-menu [auto-revert-tail-mode] 620(bindings--define-key mode-line-mode-menu [auto-revert-tail-mode]
621 '(menu-item "Auto revert tail (Tail)" auto-revert-tail-mode 621 '(menu-item "Auto revert tail (Tail)" auto-revert-tail-mode
622 :help "Revert the tail of the buffer when buffer grows" 622 :help "Revert the tail of the buffer when the file on disk grows"
623 :enable (buffer-file-name) 623 :enable (buffer-file-name)
624 :button (:toggle . (bound-and-true-p auto-revert-tail-mode)))) 624 :button (:toggle . (bound-and-true-p auto-revert-tail-mode))))
625(bindings--define-key mode-line-mode-menu [auto-revert-mode] 625(bindings--define-key mode-line-mode-menu [auto-revert-mode]
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index 32be336d13a..e15eba75924 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -624,7 +624,7 @@ MIME-TYPE specifies a MIME type and parameters, which defaults to the
624value of `mm-uu-text-plain-type'." 624value of `mm-uu-text-plain-type'."
625 (let ((case-fold-search t) 625 (let ((case-fold-search t)
626 (mm-uu-text-plain-type (or mime-type mm-uu-text-plain-type)) 626 (mm-uu-text-plain-type (or mime-type mm-uu-text-plain-type))
627 text-start start-point end-point file-name result entry func) 627 text-start start-point end-point file-name result mm-uu-entry func)
628 (save-excursion 628 (save-excursion
629 (goto-char (point-min)) 629 (goto-char (point-min))
630 (cond 630 (cond
@@ -637,26 +637,26 @@ value of `mm-uu-text-plain-type'."
637 (setq text-start (point)) 637 (setq text-start (point))
638 (while (re-search-forward mm-uu-beginning-regexp nil t) 638 (while (re-search-forward mm-uu-beginning-regexp nil t)
639 (setq start-point (match-beginning 0) 639 (setq start-point (match-beginning 0)
640 entry nil) 640 mm-uu-entry nil)
641 (let ((alist mm-uu-type-alist) 641 (let ((alist mm-uu-type-alist)
642 (beginning-regexp (match-string 0))) 642 (beginning-regexp (match-string 0)))
643 (while (not entry) 643 (while (not mm-uu-entry)
644 (if (string-match (mm-uu-beginning-regexp (car alist)) 644 (if (string-match (mm-uu-beginning-regexp (car alist))
645 beginning-regexp) 645 beginning-regexp)
646 (setq entry (car alist)) 646 (setq mm-uu-entry (car alist))
647 (pop alist)))) 647 (pop alist))))
648 (if (setq func (mm-uu-function-1 entry)) 648 (if (setq func (mm-uu-function-1 mm-uu-entry))
649 (funcall func)) 649 (funcall func))
650 (forward-line);; in case of failure 650 (forward-line);; in case of failure
651 (when (and (not (mm-uu-configure-p (mm-uu-type entry) 'disabled)) 651 (when (and (not (mm-uu-configure-p (mm-uu-type mm-uu-entry) 'disabled))
652 (let ((end-regexp (mm-uu-end-regexp entry))) 652 (let ((end-regexp (mm-uu-end-regexp mm-uu-entry)))
653 (if (not end-regexp) 653 (if (not end-regexp)
654 (or (setq end-point (point-max)) t) 654 (or (setq end-point (point-max)) t)
655 (prog1 655 (prog1
656 (re-search-forward end-regexp nil t) 656 (re-search-forward end-regexp nil t)
657 (forward-line) 657 (forward-line)
658 (setq end-point (point))))) 658 (setq end-point (point)))))
659 (or (not (setq func (mm-uu-function-2 entry))) 659 (or (not (setq func (mm-uu-function-2 mm-uu-entry)))
660 (funcall func))) 660 (funcall func)))
661 (if (and (> start-point text-start) 661 (if (and (> start-point text-start)
662 (progn 662 (progn
@@ -675,7 +675,7 @@ value of `mm-uu-text-plain-type'."
675 mm-uu-text-plain-type) 675 mm-uu-text-plain-type)
676 result)) 676 result))
677 (push 677 (push
678 (funcall (mm-uu-function-extract entry)) 678 (funcall (mm-uu-function-extract mm-uu-entry))
679 result) 679 result)
680 (goto-char (setq text-start end-point)))) 680 (goto-char (setq text-start end-point))))
681 (when result 681 (when result
diff --git a/lisp/image.el b/lisp/image.el
index 2a8ea1fb886..b5f22351377 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -977,7 +977,7 @@ default is 20%."
977 977
978(defun image--get-imagemagick-and-warn () 978(defun image--get-imagemagick-and-warn ()
979 (unless (or (fboundp 'imagemagick-types) (featurep 'ns)) 979 (unless (or (fboundp 'imagemagick-types) (featurep 'ns))
980 (error "Can't rescale images without ImageMagick support")) 980 (error "Cannot rescale images without ImageMagick support"))
981 (let ((image (image--get-image))) 981 (let ((image (image--get-image)))
982 (image-flush image) 982 (image-flush image)
983 (when (fboundp 'imagemagick-types) 983 (when (fboundp 'imagemagick-types)
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 9ce4ff84627..14e251e0667 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -425,6 +425,14 @@ See `compilation-error-regexp-alist' for format details.")
425(defvar grep-context-face 'shadow 425(defvar grep-context-face 'shadow
426 "Face name to use for grep context lines.") 426 "Face name to use for grep context lines.")
427 427
428(defvar grep-num-matches-found 0)
429
430(defconst grep-mode-line-matches
431 `(" [" (:propertize (:eval (int-to-string grep-num-matches-found))
432 face ,grep-hit-face
433 help-echo "Number of matches so far")
434 "]"))
435
428(defvar grep-mode-font-lock-keywords 436(defvar grep-mode-font-lock-keywords
429 '(;; Command output lines. 437 '(;; Command output lines.
430 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$" 438 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$"
@@ -432,7 +440,7 @@ See `compilation-error-regexp-alist' for format details.")
432 ;; remove match from grep-regexp-alist before fontifying 440 ;; remove match from grep-regexp-alist before fontifying
433 ("^Grep[/a-zA-z]* started.*" 441 ("^Grep[/a-zA-z]* started.*"
434 (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t)) 442 (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t))
435 ("^Grep[/a-zA-z]* finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" 443 ("^Grep[/a-zA-z]* finished with \\(?:\\(\\(?:[0-9]+ \\)?matches found\\)\\|\\(no matches found\\)\\).*"
436 (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t) 444 (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t)
437 (1 compilation-info-face nil t) 445 (1 compilation-info-face nil t)
438 (2 compilation-warning-face nil t)) 446 (2 compilation-warning-face nil t))
@@ -503,21 +511,28 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
503 (setenv "GREP_COLOR" "01;31") 511 (setenv "GREP_COLOR" "01;31")
504 ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions 512 ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions
505 (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne")) 513 (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne"))
514 (setq-local grep-num-matches-found 0)
506 (set (make-local-variable 'compilation-exit-message-function) 515 (set (make-local-variable 'compilation-exit-message-function)
507 (lambda (status code msg) 516 'grep-exit-message)
508 (if (eq status 'exit)
509 ;; This relies on the fact that `compilation-start'
510 ;; sets buffer-modified to nil before running the command,
511 ;; so the buffer is still unmodified if there is no output.
512 (cond ((and (zerop code) (buffer-modified-p))
513 '("finished (matches found)\n" . "matched"))
514 ((not (buffer-modified-p))
515 '("finished with no matches found\n" . "no match"))
516 (t
517 (cons msg code)))
518 (cons msg code))))
519 (run-hooks 'grep-setup-hook)) 517 (run-hooks 'grep-setup-hook))
520 518
519(defun grep-exit-message (status code msg)
520 "Return a status message for grep results."
521 (if (eq status 'exit)
522 ;; This relies on the fact that `compilation-start'
523 ;; sets buffer-modified to nil before running the command,
524 ;; so the buffer is still unmodified if there is no output.
525 (cond ((and (zerop code) (buffer-modified-p))
526 (if (> grep-num-matches-found 0)
527 (cons (format "finished with %d matches found\n" grep-num-matches-found)
528 "matched")
529 '("finished with matches found\n" . "matched")))
530 ((not (buffer-modified-p))
531 '("finished with no matches found\n" . "no match"))
532 (t
533 (cons msg code)))
534 (cons msg code)))
535
521(defun grep-filter () 536(defun grep-filter ()
522 "Handle match highlighting escape sequences inserted by the grep process. 537 "Handle match highlighting escape sequences inserted by the grep process.
523This function is called from `compilation-filter-hook'." 538This function is called from `compilation-filter-hook'."
@@ -535,7 +550,8 @@ This function is called from `compilation-filter-hook'."
535 (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 1) 550 (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 1)
536 (replace-match (propertize (match-string 1) 551 (replace-match (propertize (match-string 1)
537 'face nil 'font-lock-face grep-match-face) 552 'face nil 'font-lock-face grep-match-face)
538 t t)) 553 t t)
554 (cl-incf grep-num-matches-found))
539 ;; Delete all remaining escape sequences 555 ;; Delete all remaining escape sequences
540 (goto-char beg) 556 (goto-char beg)
541 (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) 557 (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
@@ -775,6 +791,8 @@ This function is called from `compilation-filter-hook'."
775 grep-hit-face) 791 grep-hit-face)
776 (set (make-local-variable 'compilation-error-regexp-alist) 792 (set (make-local-variable 'compilation-error-regexp-alist)
777 grep-regexp-alist) 793 grep-regexp-alist)
794 (set (make-local-variable 'compilation-mode-line-errors)
795 grep-mode-line-matches)
778 ;; compilation-directory-matcher can't be nil, so we set it to a regexp that 796 ;; compilation-directory-matcher can't be nil, so we set it to a regexp that
779 ;; can never match. 797 ;; can never match.
780 (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`")) 798 (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`"))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 21f56c9f55a..b87701536f8 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -996,7 +996,7 @@ Within directories, only files already under version control are noticed."
996 ((derived-mode-p 'diff-mode) diff-vc-backend) 996 ((derived-mode-p 'diff-mode) diff-vc-backend)
997 ;; Maybe we could even use comint-mode rather than shell-mode? 997 ;; Maybe we could even use comint-mode rather than shell-mode?
998 ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode) 998 ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode)
999 (vc-responsible-backend default-directory)) 999 (ignore-errors (vc-responsible-backend default-directory)))
1000 (vc-mode (vc-backend buffer-file-name)))) 1000 (vc-mode (vc-backend buffer-file-name))))
1001 1001
1002(declare-function vc-dir-current-file "vc-dir" ()) 1002(declare-function vc-dir-current-file "vc-dir" ())