diff options
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/antlr-mode.el | 8 | ||||
-rw-r--r-- | lisp/progmodes/cc-engine.el | 45 | ||||
-rw-r--r-- | lisp/progmodes/cc-fonts.el | 20 | ||||
-rw-r--r-- | lisp/progmodes/cc-langs.el | 14 | ||||
-rw-r--r-- | lisp/progmodes/cc-mode.el | 6 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 9 | ||||
-rw-r--r-- | lisp/progmodes/cperl-mode.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/gdb-mi.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/make-mode.el | 21 | ||||
-rw-r--r-- | lisp/progmodes/project.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 32 | ||||
-rw-r--r-- | lisp/progmodes/xref.el | 19 |
12 files changed, 130 insertions, 50 deletions
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index 733deebdf53..1aee1107e62 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -5,7 +5,7 @@ ;; Author: Christoph Wedler <Christoph.Wedler@sap.com> ;; Keywords: languages, ANTLR, code generator ;; Version: 2.2c -;; URL: http://antlr-mode.sourceforge.net/ +;; URL: https://antlr-mode.sourceforge.net/ ;; This file is part of GNU Emacs. @@ -29,7 +29,7 @@ ;; supported options and various other things like running ANTLR from within ;; Emacs. -;; For details, check <http://antlr-mode.sourceforge.net/> or, if you prefer +;; For details, check <https://antlr-mode.sourceforge.net/> or, if you prefer ;; the manual style, follow all commands mentioned in the documentation of ;; `antlr-mode'. ANTLR is a LL(k)-based recognition tool which generates ;; lexers, parsers and tree transformers in Java, C++ or Sather and can be @@ -106,12 +106,12 @@ "Major mode for ANTLR grammar files." :group 'languages :link '(emacs-commentary-link "antlr-mode.el") - :link '(url-link "http://antlr-mode.sourceforge.net/") + :link '(url-link "https://antlr-mode.sourceforge.net/") :prefix "antlr-") (defconst antlr-version "2.2c" "ANTLR major mode version number. -Check <http://antlr-mode.sourceforge.net/> for the newest.") +Check <https://antlr-mode.sourceforge.net/> for the newest.") ;;;=========================================================================== diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 0ac96219a19..223b1e917fe 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -8356,6 +8356,23 @@ multi-line strings (but not C++, for example)." (goto-char here)))) t) +(defun c-forward-over-colon-type-list () + ;; If we're at a sequence of characters which can extend from, e.g., + ;; a class name up to a colon introducing an inheritance list, + ;; move forward over them, including the colon, and return non-nil. + ;; Otherwise return nil, leaving point unmoved. + (let ((here (point)) pos) + (while (and (re-search-forward c-sub-colon-type-list-re nil t) + (not (eq (char-after) ?:)) + (c-major-mode-is 'c++-mode) + (setq pos (c-looking-at-c++-attribute))) + (goto-char pos)) + (if (eq (char-after) ?:) + (progn (forward-char) + t) + (goto-char here) + nil))) + (defun c-forward-keyword-clause (match) ;; Submatch MATCH in the current match data is assumed to surround a ;; token. If it's a keyword, move over it and any immediately @@ -8463,12 +8480,11 @@ multi-line strings (but not C++, for example)." (and c-record-type-identifiers (progn ;; If a keyword matched both one of the types above and - ;; this one, we match `c-colon-type-list-re' after the + ;; this one, we move forward to the colon following the ;; clause matched above. (goto-char safe-pos) - (looking-at c-colon-type-list-re)) + (c-forward-over-colon-type-list)) (progn - (goto-char (match-end 0)) (c-forward-syntactic-ws) (c-forward-keyword-prefixed-id type)) ;; There's a type after the `c-colon-type-list-re' match @@ -8921,8 +8937,16 @@ multi-line strings (but not C++, for example)." ;; Got some other operator. (setq c-last-identifier-range (cons (point) (match-end 0))) + (if (and (eq (char-after) ?\") + (eq (char-after (1+ (point))) ?\")) + ;; operator"" has an (?)optional tag after it. + (progn + (goto-char (match-end 0)) + (c-forward-syntactic-ws lim+) + (when (c-on-identifier) + (c-forward-token-2 1 nil lim+))) (goto-char (match-end 0)) - (c-forward-syntactic-ws lim+) + (c-forward-syntactic-ws lim+)) (setq pos (point) res 'operator))) @@ -9676,7 +9700,7 @@ point unchanged and return nil." ;; (e.g. "," or ";" or "}"). (let ((here (point)) id-start id-end brackets-after-id paren-depth decorated - got-init arglist) + got-init arglist double-double-quote) (or limit (setq limit (point-max))) (if (and (< (point) limit) @@ -9705,6 +9729,10 @@ point unchanged and return nil." (setq id-start (point)) (if (looking-at c-overloadable-operators-regexp) (progn + (when (and (c-major-mode-is 'c++-mode) + (eq (char-after) ?\") + (eq (char-after (1+ (point))) ?\")) + (setq double-double-quote t)) (goto-char (match-end 0)) (c-forward-syntactic-ws limit) (setq got-identifier t) @@ -9756,6 +9784,13 @@ point unchanged and return nil." t) (t nil))) + (progn + (c-forward-syntactic-ws limit) + (when (and double-double-quote ; C++'s operator"" _tag + (c-on-identifier)) + (c-forward-token-2 1 nil limit)) + t) + ;; Skip out of the parens surrounding the identifier. If closing ;; parens are missing, this form returns nil. (or (= paren-depth 0) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 2e71285cb36..b4ff32b9070 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1141,12 +1141,28 @@ casts and declarations are fontified. Used on level 2 and higher." (while (and (< (point) id-end) (re-search-forward c-opt-identifier-prefix-key id-end t)) (c-forward-syntactic-ws limit)))) - (when (not (get-text-property (point) 'face)) + ;; Only apply the face when the text doesn't have one yet. + ;; Exception: The "" in C++'s operator"" will already wrongly have + ;; string face. + (when (memq (get-text-property (point) 'face) + '(nil font-lock-string-face)) (c-put-font-lock-face (point) id-end (cond ((not (memq types '(nil t))) types) (is-function 'font-lock-function-name-face) - (t 'font-lock-variable-name-face)))))) + (t 'font-lock-variable-name-face)))) + ;; Fontify any _tag in C++'s operator"" _tag. + (when (and + (c-major-mode-is 'c++-mode) + (equal (buffer-substring-no-properties id-start id-end) + "\"\"")) + (goto-char id-end) + (c-forward-syntactic-ws limit) + (when (c-on-identifier) + (c-put-font-lock-face + (point) + (progn (c-forward-over-token) (point)) + font-lock-function-name-face))))) (and template-class (eq init-char ?=) ; C++ "<class X = Y>"? (progn diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index cd23483a58f..b17718cfd54 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -93,7 +93,7 @@ ;; definitions (i.e. this file and/or cc-fonts.el) if necessary. ;; ;; A small example of a derived mode is available at -;; <http://cc-mode.sourceforge.net/derived-mode-ex.el>. It also +;; <https://cc-mode.sourceforge.net/derived-mode-ex.el>. It also ;; contains some useful hints for derived mode developers. ;;; Using language variables: @@ -1449,8 +1449,7 @@ form\". See also `c-op-identifier-prefix'." "??'=" "xor_eq" "&=" "and_eq" "|=" "??!=" "or_eq" "<<" ">>" ">>=" "<<=" "==" "!=" "not_eq" "<=>" "<=" ">=" "&&" "and" "||" "??!??!" "or" "++" "--" "," "->*" "->" - "()" "[]" "<::>" "??(??)") - ;; These work like identifiers in Pike. + "()" "[]" "\"\"" "<::>" "??(??)") pike '("`+" "`-" "`&" "`|" "`^" "`<<" "`>>" "`*" "`/" "`%" "`~" "`==" "`<" "`>" "`!" "`[]" "`[]=" "`->" "`->=" "`()" "``+" "``-" "``&" "``|" "``^" "``<<" "``>>" "``*" "``/" "``%" @@ -2936,6 +2935,15 @@ regexp if `c-colon-type-list-kwds' isn't nil." "[^][{}();,/#=:]*:"))) (c-lang-defvar c-colon-type-list-re (c-lang-const c-colon-type-list-re)) +(c-lang-defconst c-sub-colon-type-list-re + "Regexp matching buffer content that may come between a keyword in +`c-colon-type-list-kwds' and a putative colon, or nil if there are no +such keywords. Exception: it does not match any C++ attributes." + t (if (c-lang-const c-colon-type-list-re) + (substring (c-lang-const c-colon-type-list-re) 0 -1))) +(c-lang-defvar c-sub-colon-type-list-re + (c-lang-const c-sub-colon-type-list-re)) + (c-lang-defconst c-paren-nontype-kwds "Keywords that may be followed by a parenthesis expression that doesn't contain type identifiers." diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2003b09ded2..dce300f33c9 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -66,12 +66,12 @@ ;; You can get the latest version of CC Mode, including PostScript ;; documentation and separate individual files from: ;; -;; http://cc-mode.sourceforge.net/ +;; https://cc-mode.sourceforge.net/ ;; ;; You can join a moderated CC Mode announcement-only mailing list by ;; visiting ;; -;; http://lists.sourceforge.net/mailman/listinfo/cc-mode-announce +;; https://lists.sourceforge.net/mailman/listinfo/cc-mode-announce ;; Externally maintained major modes which use CC-mode's engine include: ;; - cuda-mode @@ -172,7 +172,7 @@ ;; `c-font-lock-init' too to set up CC Mode's font lock support. ;; ;; See cc-langs.el for further info. A small example of a derived mode -;; is also available at <http://cc-mode.sourceforge.net/ +;; is also available at <https://cc-mode.sourceforge.net/ ;; derived-mode-ex.el>. (defun c-leave-cc-mode-mode () diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index ded5d2130e5..6473b507785 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -980,12 +980,17 @@ Faces `compilation-error-face', `compilation-warning-face', "Face name to use for leaving directory messages.") (defcustom compilation-auto-jump-to-first-error nil - "If non-nil, automatically jump to the first error during compilation." + "If non-nil, automatically jump to the first error during compilation. + +The value `if-location-known' means automatically jump to the first error +if the error's file can be found. The value `first-known' means jump to +the first error whose file can be found. Any other non-nil value means +jump to the first error unconditionally." :type '(choice (const :tag "Never" nil) (const :tag "Always" t) (const :tag "If location known" if-location-known) (const :tag "First known location" first-known)) - :version "23.1") + :version "29.1") (defvar-local compilation-auto-jump-to-next nil "If non-nil, automatically jump to the next error encountered.") diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 20a73e238e9..539b2771490 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -8323,7 +8323,7 @@ the appropriate statement modifier." 'cperl-short-docs 'variable-documentation)))) (Man-switches "") - (manual-program (if is-func "perldoc -f" "perldoc"))) + (manual-program (concat "perldoc -i" (if is-func " -f")))) (Man-getpage-in-background word))) ;;;###autoload diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 6e8032b7eae..0de3d213a4d 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -966,7 +966,7 @@ detailed description of this mode. (if gdb-active-process (gdb-gud-context-command "-exec-continue") "-exec-run"))) - "C-v" "Start or continue execution. Use a prefix to specify arguments.") + "\C-v" "Start or continue execution. Use a prefix to specify arguments.") ;; For debugging Emacs only. (gud-def gud-pp diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index cbbcf1c2b7c..5f265212992 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -488,17 +488,12 @@ not be enclosed in { } or ( )." (defconst makefile-imake-font-lock-keywords - (append - (makefile-make-font-lock-keywords - makefile-var-use-regex - makefile-statements - t - nil - '("^XCOMM.*$" . font-lock-comment-face) - '("XVAR\\(?:use\\|def\\)[0-9]" 0 font-lock-keyword-face prepend) - '("@@" . font-lock-preprocessor-face) - ) - cpp-font-lock-keywords)) + (append (list '("XCOMM.*$" . font-lock-comment-face) + '("XVAR\\(?:use\\|def\\)[0-9]" 0 + font-lock-keyword-face prepend) + '("@@" . font-lock-preprocessor-face)) + cpp-font-lock-keywords + makefile-font-lock-keywords)) (defconst makefile-syntax-propertize-function @@ -932,7 +927,9 @@ Makefile mode can be configured by modifying the following variables: :syntax-table makefile-imake-mode-syntax-table (setq-local syntax-propertize-function nil) (setq font-lock-defaults - `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults)))) + `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults))) + (setq-local comment-start "XCOMM") + (setq-local comment-start-skip "XCOMM[ \t]*")) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ee94d0d85d8..ac278edd409 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1,7 +1,7 @@ ;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2022 Free Software Foundation, Inc. -;; Version: 0.8.1 +;; Version: 0.8.2 ;; Package-Requires: ((emacs "26.1") (xref "1.4.0")) ;; This is a GNU ELPA :core package. Avoid using functionality that diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 80c5b31b6ea..0de76b0bde3 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3413,15 +3413,25 @@ detecting a prompt at the end of the buffer." "Send STRING to PROCESS and inhibit output. Return the output." (or process (setq process (python-shell-get-process-or-error))) - (cl-letf (((process-filter process) - (lambda (_proc str) - (with-current-buffer (process-buffer process) - (python-shell-output-filter str)))) - (python-shell-output-filter-in-progress t) - (inhibit-quit t)) + (cl-letf* (((process-filter process) + (lambda (_proc str) + (with-current-buffer (process-buffer process) + (python-shell-output-filter str)))) + (python-shell-output-filter-in-progress t) + (inhibit-quit t) + (buffer (process-buffer process)) + (last-prompt (cond ((boundp 'comint-last-prompt-overlay) + 'comint-last-prompt-overlay) + ((boundp 'comint-last-prompt) + 'comint-last-prompt))) + (last-prompt-value (buffer-local-value last-prompt buffer))) (or (with-local-quit - (python-shell-send-string string process) + (unwind-protect + (python-shell-send-string string process) + (when (not (null last-prompt)) + (with-current-buffer buffer + (set last-prompt last-prompt-value)))) (while python-shell-output-filter-in-progress ;; `python-shell-output-filter' takes care of setting ;; `python-shell-output-filter-in-progress' to NIL after it @@ -3430,7 +3440,7 @@ Return the output." (prog1 python-shell-output-filter-buffer (setq python-shell-output-filter-buffer nil))) - (with-current-buffer (process-buffer process) + (with-current-buffer buffer (comint-interrupt-subjob))))) (defun python-shell-internal-send-string (string) @@ -4059,7 +4069,8 @@ With argument MSG show activation/deactivation message." Optional argument PROCESS forces completions to be retrieved using that one instead of current buffer's process." (setq process (or process (get-buffer-process (current-buffer)))) - (let* ((line-start (if (derived-mode-p 'inferior-python-mode) + (let* ((is-shell-buffer (derived-mode-p 'inferior-python-mode)) + (line-start (if is-shell-buffer ;; Working on a shell buffer: use prompt end. (cdr (python-util-comint-last-prompt)) (line-beginning-position))) @@ -4090,7 +4101,8 @@ using that one instead of current buffer's process." (completion-fn (with-current-buffer (process-buffer process) (cond ((or (null prompt) - (< (point) (cdr prompt-boundaries))) + (and is-shell-buffer + (< (point) (cdr prompt-boundaries)))) #'ignore) ((or (not python-shell-completion-native-enable) ;; Even if native completion is enabled, for diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index ac04b64ce59..bb36688ef85 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -751,17 +751,22 @@ quit the *xref* buffer." (defun xref-query-replace-in-results (from to) "Perform interactive replacement of FROM with TO in all displayed xrefs. -This command interactively replaces FROM with TO in the names of the +This function interactively replaces FROM with TO in the names of the references displayed in the current *xref* buffer. -When called interactively, it uses '.*' as FROM, which means -replace the whole name. Unless called with prefix argument, in -which case the user is prompted for both FROM and TO. +When called interactively, it uses '.*' as FROM, which means replace +the whole name, and prompts the user for TO. +If invoked with prefix argument, it prompts the user for both FROM and TO. As each match is found, the user must type a character saying what to do with it. Type SPC or `y' to replace the match, DEL or `n' to skip and go to the next match. For more directions, -type \\[help-command] at that time." +type \\[help-command] at that time. + +Note that this function cannot be used in *xref* buffers that show +a partial list of all references, such as the *xref* buffer created +by \\[xref-find-definitions] and its variants, since those list only +some of the references to the identifiers." (interactive (let* ((fr (if current-prefix-arg @@ -891,7 +896,9 @@ ITEMS is an xref item which " ; FIXME: Expand documentation. (setq pairs (cdr buf-pairs)) (setq continue (perform-replace from to t t nil nil multi-query-replace-map))) - (unless did-it-once (user-error "No suitable matches here")) + (unless did-it-once + (user-error + "Cannot perform global renaming of symbols using find-definition results")) (when (and continue (not buf-pairs)) (message "All results processed")))) |