aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-02-15 10:29:02 -0500
committerStefan Monnier2019-02-15 10:29:02 -0500
commit877eba7249d0d352ff489f1fceb8362c08814494 (patch)
tree28d87befc07ed64dbb2d856dc2f60d7b6b6fa0ff
parent00b8c7ef96dacaf36ec6e66356b4d100ad9b1530 (diff)
downloademacs-877eba7249d0d352ff489f1fceb8362c08814494.tar.gz
emacs-877eba7249d0d352ff489f1fceb8362c08814494.zip
* lisp/progmodes/compile.el: Remove redundant :groups
(compilation-shell-minor-mode, compilation-minor-mode): Use :lighter rather than the old positional args. (compilation-next-error): Make "No error here" into a user-error.
-rw-r--r--lisp/progmodes/compile.el75
1 files changed, 23 insertions, 52 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 581a98d56cd..9fbe3614fd1 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -43,23 +43,20 @@
43;;;###autoload 43;;;###autoload
44(defcustom compilation-mode-hook nil 44(defcustom compilation-mode-hook nil
45 "List of hook functions run by `compilation-mode'." 45 "List of hook functions run by `compilation-mode'."
46 :type 'hook 46 :type 'hook)
47 :group 'compilation)
48 47
49;;;###autoload 48;;;###autoload
50(defcustom compilation-start-hook nil 49(defcustom compilation-start-hook nil
51 "Hook run after starting a new compilation process. 50 "Hook run after starting a new compilation process.
52The hook is run with one argument, the new process." 51The hook is run with one argument, the new process."
53 :type 'hook 52 :type 'hook)
54 :group 'compilation)
55 53
56;;;###autoload 54;;;###autoload
57(defcustom compilation-window-height nil 55(defcustom compilation-window-height nil
58 "Number of lines in a compilation window. 56 "Number of lines in a compilation window.
59If nil, use Emacs default." 57If nil, use Emacs default."
60 :type '(choice (const :tag "Default" nil) 58 :type '(choice (const :tag "Default" nil)
61 integer) 59 integer))
62 :group 'compilation)
63 60
64(defvar compilation-filter-hook nil 61(defvar compilation-filter-hook nil
65 "Hook run after `compilation-filter' has inserted a string into the buffer. 62 "Hook run after `compilation-filter' has inserted a string into the buffer.
@@ -526,7 +523,7 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
526 "Alist of values for `compilation-error-regexp-alist'.") 523 "Alist of values for `compilation-error-regexp-alist'.")
527 524
528(defcustom compilation-error-regexp-alist 525(defcustom compilation-error-regexp-alist
529 (mapcar 'car compilation-error-regexp-alist-alist) 526 (mapcar #'car compilation-error-regexp-alist-alist)
530 "Alist that specifies how to match errors in compiler output. 527 "Alist that specifies how to match errors in compiler output.
531On GNU and Unix, any string is a valid filename, so these 528On GNU and Unix, any string is a valid filename, so these
532matchers must make some common sense assumptions, which catch 529matchers must make some common sense assumptions, which catch
@@ -581,8 +578,7 @@ listed text properties PROP# are given values VAL# as well."
581 :type '(repeat (choice (symbol :tag "Predefined symbol") 578 :type '(repeat (choice (symbol :tag "Predefined symbol")
582 (sexp :tag "Error specification"))) 579 (sexp :tag "Error specification")))
583 :link `(file-link :tag "example file" 580 :link `(file-link :tag "example file"
584 ,(expand-file-name "compilation.txt" data-directory)) 581 ,(expand-file-name "compilation.txt" data-directory)))
585 :group 'compilation)
586 582
587;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp) 583;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp)
588(defvar compilation-directory nil 584(defvar compilation-directory nil
@@ -642,7 +638,6 @@ If this is buffer-local in the destination buffer, Emacs obeys
642that value, otherwise it uses the value in the *compilation* 638that value, otherwise it uses the value in the *compilation*
643buffer. This enables a major-mode to specify its own value." 639buffer. This enables a major-mode to specify its own value."
644 :type 'boolean 640 :type 'boolean
645 :group 'compilation
646 :version "20.4") 641 :version "20.4")
647 642
648(defcustom compilation-read-command t 643(defcustom compilation-read-command t
@@ -653,15 +648,13 @@ Note that changing this to nil may be a security risk, because a
653file might define a malicious `compile-command' as a file local 648file might define a malicious `compile-command' as a file local
654variable, and you might not notice. Therefore, `compile-command' 649variable, and you might not notice. Therefore, `compile-command'
655is considered unsafe if this variable is nil." 650is considered unsafe if this variable is nil."
656 :type 'boolean 651 :type 'boolean)
657 :group 'compilation)
658 652
659;;;###autoload 653;;;###autoload
660(defcustom compilation-ask-about-save t 654(defcustom compilation-ask-about-save t
661 "Non-nil means \\[compile] asks which buffers to save before compiling. 655 "Non-nil means \\[compile] asks which buffers to save before compiling.
662Otherwise, it saves all modified buffers without asking." 656Otherwise, it saves all modified buffers without asking."
663 :type 'boolean 657 :type 'boolean)
664 :group 'compilation)
665 658
666(defcustom compilation-save-buffers-predicate nil 659(defcustom compilation-save-buffers-predicate nil
667 "The second argument (PRED) passed to `save-some-buffers' before compiling. 660 "The second argument (PRED) passed to `save-some-buffers' before compiling.
@@ -675,7 +668,6 @@ of `my-compilation-root' here."
675 (const :tag "Default (save all file-visiting buffers)" nil) 668 (const :tag "Default (save all file-visiting buffers)" nil)
676 (const :tag "Save all buffers" t) 669 (const :tag "Save all buffers" t)
677 function) 670 function)
678 :group 'compilation
679 :version "24.1") 671 :version "24.1")
680 672
681;;;###autoload 673;;;###autoload
@@ -684,8 +676,7 @@ of `my-compilation-root' here."
684Elements should be directory names, not file names of directories. 676Elements should be directory names, not file names of directories.
685The value nil as an element means to try the default directory." 677The value nil as an element means to try the default directory."
686 :type '(repeat (choice (const :tag "Default" nil) 678 :type '(repeat (choice (const :tag "Default" nil)
687 (string :tag "Directory"))) 679 (string :tag "Directory"))))
688 :group 'compilation)
689 680
690;;;###autoload 681;;;###autoload
691(defcustom compile-command (purecopy "make -k ") 682(defcustom compile-command (purecopy "make -k ")
@@ -705,8 +696,7 @@ You might also use mode hooks to specify it in certain modes, like this:
705 (file-name-sans-extension buffer-file-name)))))))) 696 (file-name-sans-extension buffer-file-name))))))))
706 697
707It's often useful to leave a space at the end of the value." 698It's often useful to leave a space at the end of the value."
708 :type 'string 699 :type 'string)
709 :group 'compilation)
710;;;###autoload(put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or (not (boundp 'compilation-read-command)) compilation-read-command)))) 700;;;###autoload(put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or (not (boundp 'compilation-read-command)) compilation-read-command))))
711 701
712;;;###autoload 702;;;###autoload
@@ -715,7 +705,6 @@ It's often useful to leave a space at the end of the value."
715This only affects platforms that support asynchronous processes (see 705This only affects platforms that support asynchronous processes (see
716`start-process'); synchronous compilation processes never accept input." 706`start-process'); synchronous compilation processes never accept input."
717 :type 'boolean 707 :type 'boolean
718 :group 'compilation
719 :version "22.1") 708 :version "22.1")
720 709
721;; A weak per-compilation-buffer hash indexed by (FILENAME . DIRECTORY). Each 710;; A weak per-compilation-buffer hash indexed by (FILENAME . DIRECTORY). Each
@@ -741,7 +730,6 @@ This list is temporarily prepended to `process-environment' prior to
741starting the compilation process." 730starting the compilation process."
742 :type '(repeat (string :tag "ENVVARNAME=VALUE")) 731 :type '(repeat (string :tag "ENVVARNAME=VALUE"))
743 :options '(("LANG=C")) 732 :options '(("LANG=C"))
744 :group 'compilation
745 :version "24.1") 733 :version "24.1")
746 734
747;; History of compile commands. 735;; History of compile commands.
@@ -750,19 +738,16 @@ starting the compilation process."
750(defface compilation-error 738(defface compilation-error
751 '((t :inherit error)) 739 '((t :inherit error))
752 "Face used to highlight compiler errors." 740 "Face used to highlight compiler errors."
753 :group 'compilation
754 :version "22.1") 741 :version "22.1")
755 742
756(defface compilation-warning 743(defface compilation-warning
757 '((t :inherit warning)) 744 '((t :inherit warning))
758 "Face used to highlight compiler warnings." 745 "Face used to highlight compiler warnings."
759 :group 'compilation
760 :version "22.1") 746 :version "22.1")
761 747
762(defface compilation-info 748(defface compilation-info
763 '((t :inherit success)) 749 '((t :inherit success))
764 "Face used to highlight compiler information." 750 "Face used to highlight compiler information."
765 :group 'compilation
766 :version "22.1") 751 :version "22.1")
767 752
768;; The next three faces must be able to stand out against the 753;; The next three faces must be able to stand out against the
@@ -774,13 +759,11 @@ starting the compilation process."
774 (((class color) (min-colors 8)) (:foreground "red")) 759 (((class color) (min-colors 8)) (:foreground "red"))
775 (t (:inverse-video t :weight bold))) 760 (t (:inverse-video t :weight bold)))
776 "Face for Compilation mode's \"error\" mode line indicator." 761 "Face for Compilation mode's \"error\" mode line indicator."
777 :group 'compilation
778 :version "24.3") 762 :version "24.3")
779 763
780(defface compilation-mode-line-run 764(defface compilation-mode-line-run
781 '((t :inherit compilation-warning)) 765 '((t :inherit compilation-warning))
782 "Face for Compilation mode's \"running\" mode line indicator." 766 "Face for Compilation mode's \"running\" mode line indicator."
783 :group 'compilation
784 :version "24.3") 767 :version "24.3")
785 768
786(defface compilation-mode-line-exit 769(defface compilation-mode-line-exit
@@ -790,19 +773,16 @@ starting the compilation process."
790 (((class color)) (:foreground "green" :weight bold)) 773 (((class color)) (:foreground "green" :weight bold))
791 (t (:weight bold))) 774 (t (:weight bold)))
792 "Face for Compilation mode's \"exit\" mode line indicator." 775 "Face for Compilation mode's \"exit\" mode line indicator."
793 :group 'compilation
794 :version "24.3") 776 :version "24.3")
795 777
796(defface compilation-line-number 778(defface compilation-line-number
797 '((t :inherit font-lock-keyword-face)) 779 '((t :inherit font-lock-keyword-face))
798 "Face for displaying line numbers in compiler messages." 780 "Face for displaying line numbers in compiler messages."
799 :group 'compilation
800 :version "22.1") 781 :version "22.1")
801 782
802(defface compilation-column-number 783(defface compilation-column-number
803 '((t :inherit font-lock-doc-face)) 784 '((t :inherit font-lock-doc-face))
804 "Face for displaying column numbers in compiler messages." 785 "Face for displaying column numbers in compiler messages."
805 :group 'compilation
806 :version "22.1") 786 :version "22.1")
807 787
808(defcustom compilation-message-face 'underline 788(defcustom compilation-message-face 'underline
@@ -811,7 +791,6 @@ Faces `compilation-error-face', `compilation-warning-face',
811`compilation-info-face', `compilation-line-face' and 791`compilation-info-face', `compilation-line-face' and
812`compilation-column-face' get prepended to this, when applicable." 792`compilation-column-face' get prepended to this, when applicable."
813 :type 'face 793 :type 'face
814 :group 'compilation
815 :version "22.1") 794 :version "22.1")
816 795
817(defvar compilation-error-face 'compilation-error 796(defvar compilation-error-face 'compilation-error
@@ -844,7 +823,6 @@ Faces `compilation-error-face', `compilation-warning-face',
844(defcustom compilation-auto-jump-to-first-error nil 823(defcustom compilation-auto-jump-to-first-error nil
845 "If non-nil, automatically jump to the first error during compilation." 824 "If non-nil, automatically jump to the first error during compilation."
846 :type 'boolean 825 :type 'boolean
847 :group 'compilation
848 :version "23.1") 826 :version "23.1")
849 827
850(defvar compilation-auto-jump-to-next nil 828(defvar compilation-auto-jump-to-next nil
@@ -867,7 +845,6 @@ info, are considered errors."
867 :type '(choice (const :tag "Skip warnings and info" 2) 845 :type '(choice (const :tag "Skip warnings and info" 2)
868 (const :tag "Skip info" 1) 846 (const :tag "Skip info" 1)
869 (const :tag "No skip" 0)) 847 (const :tag "No skip" 0))
870 :group 'compilation
871 :version "22.1") 848 :version "22.1")
872 849
873(defun compilation-set-skip-threshold (level) 850(defun compilation-set-skip-threshold (level)
@@ -891,7 +868,6 @@ Visited messages are ones for which the file, line and column have been jumped
891to from the current content in the current compilation buffer, even if it was 868to from the current content in the current compilation buffer, even if it was
892from a different message." 869from a different message."
893 :type 'boolean 870 :type 'boolean
894 :group 'compilation
895 :version "22.1") 871 :version "22.1")
896 872
897(defun compilation-type (type) 873(defun compilation-type (type)
@@ -1583,7 +1559,7 @@ If the optional argument `edit-command' is non-nil, the command can be edited."
1583 (setq command (compilation-read-command (or (car compilation-arguments) 1559 (setq command (compilation-read-command (or (car compilation-arguments)
1584 command))) 1560 command)))
1585 (if compilation-arguments (setcar compilation-arguments command))) 1561 (if compilation-arguments (setcar compilation-arguments command)))
1586 (apply 'compilation-start (or compilation-arguments (list command))))) 1562 (apply #'compilation-start (or compilation-arguments (list command)))))
1587 1563
1588(defcustom compilation-scroll-output nil 1564(defcustom compilation-scroll-output nil
1589 "Non-nil to scroll the *compilation* buffer window as output appears. 1565 "Non-nil to scroll the *compilation* buffer window as output appears.
@@ -1597,8 +1573,7 @@ point on its location in the *compilation* buffer."
1597 :type '(choice (const :tag "No scrolling" nil) 1573 :type '(choice (const :tag "No scrolling" nil)
1598 (const :tag "Scroll compilation output" t) 1574 (const :tag "Scroll compilation output" t)
1599 (const :tag "Stop scrolling at the first error" first-error)) 1575 (const :tag "Stop scrolling at the first error" first-error))
1600 :version "20.3" 1576 :version "20.3")
1601 :group 'compilation)
1602 1577
1603 1578
1604(defun compilation-buffer-name (name-of-mode mode-command name-function) 1579(defun compilation-buffer-name (name-of-mode mode-command name-function)
@@ -1622,8 +1597,7 @@ Otherwise, construct a buffer name from NAME-OF-MODE."
1622 "If t, always kill a running compilation process before starting a new one. 1597 "If t, always kill a running compilation process before starting a new one.
1623If nil, ask to kill it." 1598If nil, ask to kill it."
1624 :type 'boolean 1599 :type 'boolean
1625 :version "24.3" 1600 :version "24.3")
1626 :group 'compilation)
1627 1601
1628;;;###autoload 1602;;;###autoload
1629(defun compilation-start (command &optional mode name-function highlight-regexp) 1603(defun compilation-start (command &optional mode name-function highlight-regexp)
@@ -1802,11 +1776,11 @@ Returns the compilation buffer created."
1802 (when compilation-always-kill 1776 (when compilation-always-kill
1803 (set-process-query-on-exit-flag proc nil)) 1777 (set-process-query-on-exit-flag proc nil))
1804 1778
1805 (set-process-sentinel proc 'compilation-sentinel) 1779 (set-process-sentinel proc #'compilation-sentinel)
1806 (unless (eq mode t) 1780 (unless (eq mode t)
1807 ;; Keep the comint filter, since it's needed for proper 1781 ;; Keep the comint filter, since it's needed for proper
1808 ;; handling of the prompts. 1782 ;; handling of the prompts.
1809 (set-process-filter proc 'compilation-filter)) 1783 (set-process-filter proc #'compilation-filter))
1810 ;; Use (point-max) here so that output comes in 1784 ;; Use (point-max) here so that output comes in
1811 ;; after the initial text, 1785 ;; after the initial text,
1812 ;; regardless of where the user sees point. 1786 ;; regardless of where the user sees point.
@@ -2114,7 +2088,7 @@ by replacing the first word, e.g., `compilation-scroll-output' from
2114 (let (revert-buffer-function) 2088 (let (revert-buffer-function)
2115 (revert-buffer ignore-auto noconfirm)) 2089 (revert-buffer ignore-auto noconfirm))
2116 (if (or noconfirm (yes-or-no-p (format "Restart compilation? "))) 2090 (if (or noconfirm (yes-or-no-p (format "Restart compilation? ")))
2117 (apply 'compilation-start compilation-arguments)))) 2091 (apply #'compilation-start compilation-arguments))))
2118 2092
2119(defvar compilation-current-error nil 2093(defvar compilation-current-error nil
2120 "Marker to the location from where the next error will be found. 2094 "Marker to the location from where the next error will be found.
@@ -2150,7 +2124,7 @@ Optional argument MINOR indicates this is called from
2150 ;; It's generally preferable to use after-change-functions since they 2124 ;; It's generally preferable to use after-change-functions since they
2151 ;; can be subject to combine-after-change-calls, but if we do that, we risk 2125 ;; can be subject to combine-after-change-calls, but if we do that, we risk
2152 ;; running our hook after font-lock, resulting in incorrect refontification. 2126 ;; running our hook after font-lock, resulting in incorrect refontification.
2153 (add-hook 'before-change-functions 'compilation--flush-parse nil t) 2127 (add-hook 'before-change-functions #'compilation--flush-parse nil t)
2154 ;; Also for minor mode, since it's not permanent-local. 2128 ;; Also for minor mode, since it's not permanent-local.
2155 (add-hook 'change-major-mode-hook #'compilation--remove-properties nil t) 2129 (add-hook 'change-major-mode-hook #'compilation--remove-properties nil t)
2156 (if minor 2130 (if minor
@@ -2162,7 +2136,7 @@ Optional argument MINOR indicates this is called from
2162(defun compilation--unsetup () 2136(defun compilation--unsetup ()
2163 ;; Only for minor mode. 2137 ;; Only for minor mode.
2164 (font-lock-remove-keywords nil (compilation-mode-font-lock-keywords)) 2138 (font-lock-remove-keywords nil (compilation-mode-font-lock-keywords))
2165 (remove-hook 'before-change-functions 'compilation--flush-parse t) 2139 (remove-hook 'before-change-functions #'compilation--flush-parse t)
2166 (kill-local-variable 'compilation--parsed) 2140 (kill-local-variable 'compilation--parsed)
2167 (compilation--remove-properties) 2141 (compilation--remove-properties)
2168 (font-lock-flush)) 2142 (font-lock-flush))
@@ -2175,8 +2149,7 @@ When Compilation Shell minor mode is enabled, all the
2175error-parsing commands of the Compilation major mode are 2149error-parsing commands of the Compilation major mode are
2176available but bound to keys that don't collide with Shell mode. 2150available but bound to keys that don't collide with Shell mode.
2177See `compilation-mode'." 2151See `compilation-mode'."
2178 nil " Shell-Compile" 2152 :lighter " Shell-Compile"
2179 :group 'compilation
2180 (if compilation-shell-minor-mode 2153 (if compilation-shell-minor-mode
2181 (compilation-setup t) 2154 (compilation-setup t)
2182 (compilation--unsetup))) 2155 (compilation--unsetup)))
@@ -2188,8 +2161,7 @@ See `compilation-mode'."
2188When Compilation minor mode is enabled, all the error-parsing 2161When Compilation minor mode is enabled, all the error-parsing
2189commands of Compilation major mode are available. See 2162commands of Compilation major mode are available. See
2190`compilation-mode'." 2163`compilation-mode'."
2191 nil " Compilation" 2164 :lighter " Compilation"
2192 :group 'compilation
2193 (if compilation-minor-mode 2165 (if compilation-minor-mode
2194 (compilation-setup t) 2166 (compilation-setup t)
2195 (compilation--unsetup))) 2167 (compilation--unsetup)))
@@ -2379,7 +2351,7 @@ looking for the next message."
2379 'compilation-message)) 2351 'compilation-message))
2380 (setq pt (compilation-next-single-property-change 2352 (setq pt (compilation-next-single-property-change
2381 pt 'compilation-message nil 2353 pt 'compilation-message nil
2382 (line-end-position))) 2354 (line-end-position)))
2383 (or (setq msg (get-text-property pt 'compilation-message)) 2355 (or (setq msg (get-text-property pt 'compilation-message))
2384 (setq pt (point))))) 2356 (setq pt (point)))))
2385 (setq last (compilation--loc->file-struct loc)) 2357 (setq last (compilation--loc->file-struct loc))
@@ -2397,7 +2369,7 @@ looking for the next message."
2397 "Moved back before first %s" (point-min)))) 2369 "Moved back before first %s" (point-min))))
2398 (goto-char pt) 2370 (goto-char pt)
2399 (or msg 2371 (or msg
2400 (error "No %s here" compilation-error)))) 2372 (user-error "No %s here" compilation-error))))
2401 2373
2402(defun compilation-previous-error (n) 2374(defun compilation-previous-error (n)
2403 "Move point to the previous error in the compilation buffer. 2375 "Move point to the previous error in the compilation buffer.
@@ -2585,7 +2557,6 @@ compilation output window; an arrow in the left fringe points to
2585the current message. If nil and there is no left fringe, the message 2557the current message. If nil and there is no left fringe, the message
2586displays at the top of the window; there is no arrow." 2558displays at the top of the window; there is no arrow."
2587 :type '(choice integer (const :tag "No window scrolling" nil)) 2559 :type '(choice integer (const :tag "No window scrolling" nil))
2588 :group 'compilation
2589 :version "22.1") 2560 :version "22.1")
2590 2561
2591(defsubst compilation-set-window (w mk) 2562(defsubst compilation-set-window (w mk)
@@ -2679,7 +2650,7 @@ and overlay is highlighted between MK and END-MK."
2679 (numberp next-error-highlight)) 2650 (numberp next-error-highlight))
2680 ;; We want highlighting: delete overlay on next input. 2651 ;; We want highlighting: delete overlay on next input.
2681 (add-hook 'pre-command-hook 2652 (add-hook 'pre-command-hook
2682 'compilation-goto-locus-delete-o) 2653 #'compilation-goto-locus-delete-o)
2683 ;; We don't want highlighting: delete overlay now. 2654 ;; We don't want highlighting: delete overlay now.
2684 (delete-overlay compilation-highlight-overlay)) 2655 (delete-overlay compilation-highlight-overlay))
2685 ;; We want highlighting for a limited time: 2656 ;; We want highlighting for a limited time:
@@ -2699,7 +2670,7 @@ and overlay is highlighted between MK and END-MK."
2699 (if (timerp next-error-highlight-timer) 2670 (if (timerp next-error-highlight-timer)
2700 (cancel-timer next-error-highlight-timer)) 2671 (cancel-timer next-error-highlight-timer))
2701 (remove-hook 'pre-command-hook 2672 (remove-hook 'pre-command-hook
2702 'compilation-goto-locus-delete-o)) 2673 #'compilation-goto-locus-delete-o))
2703 2674
2704(defun compilation-find-file (marker filename directory &rest formats) 2675(defun compilation-find-file (marker filename directory &rest formats)
2705 "Find a buffer for file FILENAME. 2676 "Find a buffer for file FILENAME.