diff options
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/asm-mode.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/bat-mode.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 22 | ||||
-rw-r--r-- | lisp/progmodes/cpp.el | 18 | ||||
-rw-r--r-- | lisp/progmodes/ebnf2ps.el | 15 | ||||
-rw-r--r-- | lisp/progmodes/f90.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/flymake.el | 16 | ||||
-rw-r--r-- | lisp/progmodes/gud.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/js.el | 19 | ||||
-rw-r--r-- | lisp/progmodes/octave.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/perl-mode.el | 7 | ||||
-rw-r--r-- | lisp/progmodes/project.el | 10 | ||||
-rw-r--r-- | lisp/progmodes/sh-script.el | 21 | ||||
-rw-r--r-- | lisp/progmodes/xref.el | 12 |
14 files changed, 73 insertions, 81 deletions
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index 62ff783fbac..99b2ec6d87e 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -141,8 +141,7 @@ Special commands: (setq-local comment-add 1) (setq-local comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") (setq-local comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") - (setq-local comment-end "") - (setq fill-prefix "\t")) + (setq-local comment-end "")) (defun asm-indent-line () "Auto-indent the current line." diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el index 44295c3f679..7ba8a69775e 100644 --- a/lisp/progmodes/bat-mode.el +++ b/lisp/progmodes/bat-mode.el @@ -1,4 +1,4 @@ -;;; bat-mode.el --- Major mode for editing DOS/Windows scripts +;;; bat-mode.el --- Major mode for editing DOS/Windows scripts -*- lexical-binding: t -*- ;; Copyright (C) 2003, 2008-2021 Free Software Foundation, Inc. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 94e4f3c6fa7..614ed7d835d 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -953,13 +953,11 @@ Faces `compilation-error-face', `compilation-warning-face', :type 'boolean :version "23.1") -(defvar compilation-auto-jump-to-next nil +(defvar-local compilation-auto-jump-to-next nil "If non-nil, automatically jump to the next error encountered.") -(make-variable-buffer-local 'compilation-auto-jump-to-next) -;; (defvar compilation-buffer-modtime nil +;; (defvar-local compilation-buffer-modtime nil ;; "The buffer modification time, for buffers not associated with files.") -;; (make-variable-buffer-local 'compilation-buffer-modtime) (defvar compilation-skip-to-next-location t "If non-nil, skip multiple error messages for the same source location.") @@ -1087,13 +1085,12 @@ from a different message." (:conc-name compilation--message->)) loc type end-loc rule) -(defvar compilation--previous-directory-cache nil +(defvar-local compilation--previous-directory-cache nil "A pair (POS . RES) caching the result of previous directory search. Basically, this pair says that calling (previous-single-property-change POS \\='compilation-directory) returned RES, i.e. there is no change of `compilation-directory' between POS and RES.") -(make-variable-buffer-local 'compilation--previous-directory-cache) (defun compilation--flush-directory-cache (start _end) (cond @@ -1600,8 +1597,7 @@ to `compilation-error-regexp-alist' if RULES is nil." (match-beginning mn) (match-end mn) 'font-lock-face (cadr props))))))))) -(defvar compilation--parsed -1) -(make-variable-buffer-local 'compilation--parsed) +(defvar-local compilation--parsed -1) (defun compilation--ensure-parse (limit) "Make sure the text has been parsed up to LIMIT." @@ -2673,9 +2669,8 @@ This is the value of `next-error-function' in Compilation buffers." (compilation--loc->marker end-loc)) (setf (compilation--loc->visited loc) t))) -(defvar compilation-gcpro nil +(defvar-local compilation-gcpro nil "Internal variable used to keep some values from being GC'd.") -(make-variable-buffer-local 'compilation-gcpro) (defun compilation-fake-loc (marker file &optional line col) "Preassociate MARKER with FILE. @@ -3041,7 +3036,12 @@ TRUE-DIRNAME is the `file-truename' of DIRNAME, if given." ;; Get the specified directory from FILE. (spec-directory (if (cdr file) - (file-truename (concat comint-file-name-prefix (cdr file)))))) + ;; This function is active in `compilation-filter'. + ;; There could be problems to call `file-truename' + ;; for remote compilation processes. + (if (file-remote-p default-directory) + (concat comint-file-name-prefix (cdr file)) + (file-truename (concat comint-file-name-prefix (cdr file))))))) ;; Check for a comint-file-name-prefix and prepend it if appropriate. ;; (This is very useful for compilation-minor-mode in an rlogin-mode diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index 4ea1674db02..b2c2e8dab57 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -112,9 +112,8 @@ If nil, `cpp-progress-message' prints no progress messages." :group 'cpp :version "26.1") -(defvar cpp-overlay-list nil) -;; List of cpp overlays active in the current buffer. -(make-variable-buffer-local 'cpp-overlay-list) +(defvar-local cpp-overlay-list nil + "List of cpp overlays active in the current buffer.") (defvar cpp-callback-data) (defvar cpp-state-stack) @@ -134,9 +133,8 @@ If nil, `cpp-progress-message' prints no progress messages." (defvar cpp-button-event nil) ;; This will be t in the callback for `cpp-make-button'. -(defvar cpp-edit-buffer nil) -;; Real buffer whose cpp display information we are editing. -(make-variable-buffer-local 'cpp-edit-buffer) +(defvar-local cpp-edit-buffer nil + "Real buffer whose cpp display information we are editing.") (defconst cpp-branch-list ;; Alist of branches. @@ -211,9 +209,8 @@ or a cons cell (background-color . COLOR)." ;;; Parse Buffer: -(defvar cpp-parse-symbols nil +(defvar-local cpp-parse-symbols nil "List of cpp macros used in the local buffer.") -(make-variable-buffer-local 'cpp-parse-symbols) (defconst cpp-parse-regexp ;; Regexp matching all tokens needed to find conditionals. @@ -471,9 +468,8 @@ A prefix arg suppresses display of that buffer." -(defvar cpp-edit-symbols nil) -;; Symbols defined in the edit buffer. -(make-variable-buffer-local 'cpp-edit-symbols) +(defvar-local cpp-edit-symbols nil + "Symbols defined in the edit buffer.") (define-derived-mode cpp-edit-mode fundamental-mode "CPP Edit" "Major mode for editing the criteria for highlighting cpp conditionals. diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 6f9509d152b..b376423c185 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -2941,16 +2941,11 @@ See `ebnf-style-database' documentation." (defvar ebnf-eps-executing nil) (defvar ebnf-eps-header-comment nil) (defvar ebnf-eps-footer-comment nil) -(defvar ebnf-eps-upper-x 0.0) -(make-variable-buffer-local 'ebnf-eps-upper-x) -(defvar ebnf-eps-upper-y 0.0) -(make-variable-buffer-local 'ebnf-eps-upper-y) -(defvar ebnf-eps-prod-width 0.0) -(make-variable-buffer-local 'ebnf-eps-prod-width) -(defvar ebnf-eps-max-height 0.0) -(make-variable-buffer-local 'ebnf-eps-max-height) -(defvar ebnf-eps-max-width 0.0) -(make-variable-buffer-local 'ebnf-eps-max-width) +(defvar-local ebnf-eps-upper-x 0.0) +(defvar-local ebnf-eps-upper-y 0.0) +(defvar-local ebnf-eps-prod-width 0.0) +(defvar-local ebnf-eps-max-height 0.0) +(defvar-local ebnf-eps-max-width 0.0) (defvar ebnf-eps-context nil diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 2641387986d..92b165bc641 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -926,9 +926,8 @@ then the presence of the token here allows a line-break before or after the other character, where a break would not normally be allowed. This minor issue currently only affects \"(/\" and \"/)\".") -(defvar f90-cache-position nil +(defvar-local f90-cache-position nil "Temporary position used to speed up region operations.") -(make-variable-buffer-local 'f90-cache-position) ;; Hideshow support. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 460af718aad..5d96c62b418 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -352,12 +352,20 @@ diagnostics at BEG." (flymake--diag-accessor flymake-diagnostic-data flymake--diag-data backend) (defun flymake-diagnostic-beg (diag) - "Get Flymake diagnostic DIAG's start position." - (overlay-start (flymake--diag-overlay diag))) + "Get Flymake diagnostic DIAG's start position. +This position only be queried after DIAG has been reported to Flymake." + (let ((overlay (flymake--diag-overlay diag))) + (unless overlay + (error "DIAG %s not reported to Flymake yet" diag)) + (overlay-start overlay))) (defun flymake-diagnostic-end (diag) - "Get Flymake diagnostic DIAG's end position." - (overlay-end (flymake--diag-overlay diag))) + "Get Flymake diagnostic DIAG's end position. +This position only be queried after DIAG has been reported to Flymake." + (let ((overlay (flymake--diag-overlay diag))) + (unless overlay + (error "DIAG %s not reported to Flymake yet" diag)) + (overlay-end overlay))) (cl-defun flymake--overlays (&key beg end filter compare key) "Get flymake-related overlays. diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 259da2fd019..eb114acdabc 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -638,8 +638,7 @@ The option \"--fullname\" must be included in this value." ;; receive a chunk of text which looks like it might contain the ;; beginning of a marker, we save it here between calls to the ;; filter. -(defvar gud-marker-acc "") -(make-variable-buffer-local 'gud-marker-acc) +(defvar-local gud-marker-acc "") (defun gud-gdb-marker-filter (string) (setq gud-marker-acc (concat gud-marker-acc string)) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 33bea59e3ba..cdf6536fc7e 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -717,26 +717,20 @@ This variable is like `sgml-attribute-offset'." table) "Syntax table for `js-mode'.") -(defvar js--quick-match-re nil +(defvar-local js--quick-match-re nil "Autogenerated regexp used by `js-mode' to match buffer constructs.") -(defvar js--quick-match-re-func nil +(defvar-local js--quick-match-re-func nil "Autogenerated regexp used by `js-mode' to match constructs and functions.") -(make-variable-buffer-local 'js--quick-match-re) -(make-variable-buffer-local 'js--quick-match-re-func) - -(defvar js--cache-end 1 +(defvar-local js--cache-end 1 "Last valid buffer position for the `js-mode' function cache.") -(make-variable-buffer-local 'js--cache-end) -(defvar js--last-parse-pos nil +(defvar-local js--last-parse-pos nil "Latest parse position reached by `js--ensure-cache'.") -(make-variable-buffer-local 'js--last-parse-pos) -(defvar js--state-at-last-parse-pos nil +(defvar-local js--state-at-last-parse-pos nil "Parse state at `js--last-parse-pos'.") -(make-variable-buffer-local 'js--state-at-last-parse-pos) (defun js--maybe-join (prefix separator suffix &rest list) "Helper function for `js--update-quick-match-re'. @@ -1505,8 +1499,7 @@ REGEXPS, but only if FRAMEWORK is in `js-enabled-frameworks'." (when (memq (quote ,framework) js-enabled-frameworks) (re-search-forward ,regexps limit t))))) -(defvar js--tmp-location nil) -(make-variable-buffer-local 'js--tmp-location) +(defvar-local js--tmp-location nil) (defun js--forward-destructuring-spec (&optional func) "Move forward over a JavaScript destructuring spec. diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index a14a8d75a78..c37bb1c7112 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -964,8 +964,7 @@ output is passed to the filter `inferior-octave-output-digest'." (setq list (cdr list))) (set-process-filter proc filter)))) -(defvar inferior-octave-directory-tracker-resync nil) -(make-variable-buffer-local 'inferior-octave-directory-tracker-resync) +(defvar-local inferior-octave-directory-tracker-resync nil) (defun inferior-octave-directory-tracker (string) "Tracks `cd' commands issued to the inferior Octave process. diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index d047dd543c2..0120e4a7cd1 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -143,7 +143,7 @@ '(;; Functions (nil "^[ \t]*sub\\s-+\\([-[:alnum:]+_:]+\\)" 1) ;;Variables - ("Variables" "^[ \t]*\\(?:anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1) + ("Variables" "^[ \t]*\\(?:has\\|local\\|my\\|our\\|state\\)\\s-+\\([$@%][-[:alnum:]+_:]+\\)\\s-*=" 1) ("Packages" "^[ \t]*package\\s-+\\([-[:alnum:]+_:]+\\);" 1) ("Doc sections" "^=head[0-9][ \t]+\\(.*\\)" 1)) "Imenu generic expression for Perl mode. See `imenu-generic-expression'.") @@ -188,9 +188,8 @@ "\\>") ;; ;; Fontify declarators and prefixes as types. - ("\\<\\(anon\\|argument\\|has\\|local\\|my\\|our\\|state\\|supersede\\)\\>" . font-lock-type-face) ; declarators - ("\\<\\(let\\|temp\\)\\>" . font-lock-type-face) ; prefixes - ;; + ("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . font-lock-type-face) ; declarators + ;; ;; Fontify function, variable and file name references. ("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face) ;; Additionally fontify non-scalar variables. `perl-non-scalar-variable' diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 18124227d1b..fc5e30111e5 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1,8 +1,8 @@ ;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2021 Free Software Foundation, Inc. -;; Version: 0.5.3 -;; Package-Requires: ((emacs "26.3") (xref "1.0.2")) +;; Version: 0.5.4 +;; Package-Requires: ((emacs "26.1") (xref "1.0.2")) ;; This is a GNU ELPA :core package. Avoid using functionality that ;; not compatible with the version of Emacs recorded above. @@ -928,16 +928,16 @@ if one already exists." ;;;###autoload (defun project-async-shell-command () "Run `async-shell-command' in the current project's root directory." - (interactive) (declare (interactive-only async-shell-command)) + (interactive) (let ((default-directory (project-root (project-current t)))) (call-interactively #'async-shell-command))) ;;;###autoload (defun project-shell-command () "Run `shell-command' in the current project's root directory." - (interactive) (declare (interactive-only shell-command)) + (interactive) (let ((default-directory (project-root (project-current t)))) (call-interactively #'shell-command))) @@ -974,8 +974,8 @@ loop using the command \\[fileloop-continue]." ;;;###autoload (defun project-compile () "Run `compile' in the project root." - (interactive) (declare (interactive-only compile)) + (interactive) (let ((default-directory (project-root (project-current t)))) (call-interactively #'compile))) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a417de32640..f588ad99c9d 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -541,10 +541,9 @@ sign. See `sh-feature'." :group 'sh-script) -(defvar sh-header-marker nil +(defvar-local sh-header-marker nil "When non-nil is the end of header for prepending by \\[sh-execute-region]. That command is also used for setting this variable.") -(make-variable-buffer-local 'sh-header-marker) (defcustom sh-beginning-of-command "\\([;({`|&]\\|\\`\\|[^\\]\n\\)[ \t]*\\([/~[:alnum:]:]\\)" @@ -1556,7 +1555,7 @@ with your script for an edit-interpret-debug cycle." (sh-set-shell (cond ((save-excursion (goto-char (point-min)) - (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)")) + (looking-at auto-mode-interpreter-regexp)) (match-string 2)) ((not buffer-file-name) sh-shell-file) ;; Checks that use `buffer-file-name' follow. @@ -1957,12 +1956,18 @@ May return nil if the line should not be treated as continued." ('(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) (sh-var-value 'sh-indent-for-case-label))) (`(:before . ,(or "(" "{" "[" "while" "if" "for" "case")) - (if (not (smie-rule-prev-p "&&" "||" "|")) - (when (smie-rule-hanging-p) - (smie-rule-parent)) + (cond + ((and (equal token "{") (smie-rule-parent-p "for")) + (let ((data (smie-backward-sexp "in"))) + (when (equal (nth 2 data) "for") + `(column . ,(smie-indent-virtual))))) + ((not (smie-rule-prev-p "&&" "||" "|")) + (when (smie-rule-hanging-p) + (smie-rule-parent))) + (t (unless (smie-rule-bolp) (while (equal "|" (nth 2 (smie-backward-sexp 'halfexp)))) - `(column . ,(smie-indent-virtual))))) + `(column . ,(smie-indent-virtual)))))) ;; FIXME: Maybe this handling of ;; should be made into ;; a smie-rule-terminator function that takes the substitute ";" as arg. (`(:before . ,(or ";;" ";&" ";;&")) @@ -2927,8 +2932,8 @@ option followed by a colon `:' if the option accepts an argument." (put 'sh-assignment 'delete-selection t) (defun sh-assignment (arg) "Remember preceding identifier for future completion and do self-insert." - (interactive "p") (declare (obsolete nil "27.1")) + (interactive "p") (self-insert-command arg) (sh--assignment-collect)) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index aecb30a0ad4..18fdd963fb1 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2014-2021 Free Software Foundation, Inc. ;; Version: 1.0.4 -;; Package-Requires: ((emacs "26.3")) +;; Package-Requires: ((emacs "26.1")) ;; This is a GNU ELPA :core package. Avoid functionality that is not ;; compatible with the version of Emacs recorded above. @@ -967,16 +967,16 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (let ((inhibit-read-only t) (buffer-undo-list t)) (save-excursion - (erase-buffer) (condition-case err - (xref--insert-xrefs - (xref--analyze (funcall xref--fetcher))) + (let ((alist (xref--analyze (funcall xref--fetcher)))) + (erase-buffer) + (xref--insert-xrefs alist)) (user-error + (erase-buffer) (insert (propertize (error-message-string err) - 'face 'error)))) - (goto-char (point-min))))) + 'face 'error))))))) (defun xref-show-definitions-buffer (fetcher alist) "Show the definitions list in a regular window. |