diff options
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/ada-mode.el | 82 | ||||
-rw-r--r-- | lisp/progmodes/cc-langs.el | 71 | ||||
-rw-r--r-- | lisp/progmodes/cc-mode.el | 9 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 76 | ||||
-rw-r--r-- | lisp/progmodes/delphi.el | 3 | ||||
-rw-r--r-- | lisp/progmodes/gdb-ui.el | 24 | ||||
-rw-r--r-- | lisp/progmodes/grep.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/idlw-shell.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/ld-script.el | 55 | ||||
-rw-r--r-- | lisp/progmodes/sh-script.el | 90 | ||||
-rw-r--r-- | lisp/progmodes/which-func.el | 4 |
11 files changed, 250 insertions, 168 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index 9dc74264da8..bc00d859c2d 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el @@ -1208,60 +1208,36 @@ If you use ada-xref.el: ff-file-created-hook 'ada-make-body) (add-hook 'ff-pre-load-hook 'ada-which-function-are-we-in) - ;; Some special constructs for find-file.el - ;; We do not need to add the construction for 'with', which is in the - ;; standard find-file.el + ;; Some special constructs for find-file.el. (make-local-variable 'ff-special-constructs) - - ;; Go to the parent package : - (add-to-list 'ff-special-constructs - (cons (eval-when-compile - (concat "^\\(private[ \t]\\)?[ \t]*package[ \t]+" - "\\(body[ \t]+\\)?" - "\\(\\(\\sw\\|[_.]\\)+\\)\\.\\(\\sw\\|_\\)+[ \t\n]+is")) - (lambda () - (if (fboundp 'ff-get-file) - (if (boundp 'fname) - (set 'fname (ff-get-file - ada-search-directories-internal - (ada-make-filename-from-adaname - (match-string 3)) - ada-spec-suffixes))))))) - ;; Another special construct for find-file.el : when in a separate clause, - ;; go to the correct package. - (add-to-list 'ff-special-constructs - (cons "^separate[ \t\n]*(\\(\\(\\sw\\|[_.]\\)+\\))" - (lambda () - (if (fboundp 'ff-get-file) - (if (boundp 'fname) - (setq fname (ff-get-file - ada-search-directories-internal - (ada-make-filename-from-adaname - (match-string 1)) - ada-spec-suffixes))))))) - - ;; Another special construct, that redefines the one in find-file.el. The - ;; old one can handle only one possible type of extension for Ada files - ;; remove from the list the standard "with..." that is put by find-file.el, - ;; since it uses the old ada-spec-suffix variable - ;; This one needs to replace the standard one defined in find-file.el (with - ;; Emacs <= 20.4), since that one uses the old variable ada-spec-suffix - (let ((old-construct - (assoc "^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" ff-special-constructs)) - (new-cdr - (lambda () - (if (fboundp 'ff-get-file) - (if (boundp 'fname) - (set 'fname (ff-get-file - ada-search-directories-internal - (ada-make-filename-from-adaname - (match-string 1)) - ada-spec-suffixes))))))) - (if old-construct - (setcdr old-construct new-cdr) - (add-to-list 'ff-special-constructs - (cons "^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" - new-cdr)))) + (mapc (lambda (pair) + (add-to-list 'ff-special-constructs pair)) + `( + ;; Go to the parent package. + (,(eval-when-compile + (concat "^\\(private[ \t]\\)?[ \t]*package[ \t]+" + "\\(body[ \t]+\\)?" + "\\(\\(\\sw\\|[_.]\\)+\\)\\.\\(\\sw\\|_\\)+[ \t\n]+is")) + . ,(lambda () + (ff-get-file + ada-search-directories-internal + (ada-make-filename-from-adaname (match-string 3)) + ada-spec-suffixes))) + ;; A "separate" clause. + ("^separate[ \t\n]*(\\(\\(\\sw\\|[_.]\\)+\\))" + . ,(lambda () + (ff-get-file + ada-search-directories-internal + (ada-make-filename-from-adaname (match-string 1)) + ada-spec-suffixes))) + ;; A "with" clause. + ("^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" + . ,(lambda () + (ff-get-file + ada-search-directories-internal + (ada-make-filename-from-adaname (match-string 1)) + ada-spec-suffixes))) + )) ;; Support for outline-minor-mode (set (make-local-variable 'outline-regexp) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index e7a0d03cc55..d29e75e92f0 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -134,12 +134,18 @@ (eval-and-compile ;; These are used to collect the init forms from the subsequent - ;; `c-lang-defvar'. They are used to build the lambda in - ;; `c-make-init-lang-vars-fun' below. + ;; `c-lang-defvar' and `c-lang-setvar'. They are used to build the + ;; lambda in `c-make-init-lang-vars-fun' below, and to build `defvar's + ;; and `make-variable-buffer-local's in cc-engine and + ;; `make-local-variable's in `c-init-language-vars-for'. (defvar c-lang-variable-inits nil) (defvar c-lang-variable-inits-tail nil) (setq c-lang-variable-inits (list nil) - c-lang-variable-inits-tail c-lang-variable-inits)) + c-lang-variable-inits-tail c-lang-variable-inits) + (defvar c-emacs-variable-inits nil) + (defvar c-emacs-variable-inits-tail nil) + (setq c-emacs-variable-inits (list nil) + c-emacs-variable-inits-tail c-emacs-variable-inits)) (defmacro c-lang-defvar (var val &optional doc) "Declares the buffer local variable VAR to get the value VAL. VAL is @@ -172,6 +178,25 @@ the evaluated constant value at compile time." ;; Return the symbol, like the other def* forms. `',var) +(defmacro c-lang-setvar (var val) + "Causes the variable VAR to be made buffer local and to get set to the +value VAL. VAL is evaluated and assigned at mode initialization. More +precisely, VAL is evaluated and bound to VAR when the result from the +macro `c-init-language-vars' is evaluated. VAR is typically a standard +Emacs variable like `comment-start'. + +`c-lang-const' is typically used in VAL to get the right value for the +language being initialized, and such calls will be macro expanded to +the evaluated constant value at compile time." + (let ((elem (assq var (cdr c-emacs-variable-inits)))) + (if elem + (setcdr elem (list val)) ; Maybe remove "list", sometime. 2006-07-19 + (setcdr c-emacs-variable-inits-tail (list (list var val))) + (setq c-emacs-variable-inits-tail (cdr c-emacs-variable-inits-tail)))) + + ;; Return the symbol, like the other def* forms. + `',var) + (put 'c-lang-defvar 'lisp-indent-function 'defun) ; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. ; ' @@ -1103,8 +1128,7 @@ properly." ;; In C we still default to the block comment style since line ;; comments aren't entirely portable. c "/* ") -(c-lang-defvar comment-start (c-lang-const comment-start) - 'dont-doc) +(c-lang-setvar comment-start (c-lang-const comment-start)) (c-lang-defconst comment-end "String that ends comments inserted with M-; etc. @@ -1117,8 +1141,7 @@ properly." (c-lang-const comment-start)) (concat " " (c-lang-const c-block-comment-ender)) "")) -(c-lang-defvar comment-end (c-lang-const comment-end) - 'dont-doc) +(c-lang-setvar comment-end (c-lang-const comment-end)) (c-lang-defconst comment-start-skip "Regexp to match the start of a comment plus everything up to its body. @@ -1134,8 +1157,7 @@ properly." (c-lang-const c-block-comment-starter))) "\\|") "\\)\\s *")) -(c-lang-defvar comment-start-skip (c-lang-const comment-start-skip) - 'dont-doc) +(c-lang-setvar comment-start-skip (c-lang-const comment-start-skip)) (c-lang-defconst c-syntactic-ws-start ;; Regexp matching any sequence that can start syntactic whitespace. @@ -2806,9 +2828,10 @@ way." ;;; Wrap up the `c-lang-defvar' system. ;; Compile in the list of language variables that has been collected -;; with the `c-lang-defvar' macro. Note that the first element is -;; nil. +;; with the `c-lang-defvar' and `c-lang-setvar' macros. Note that the +;; first element of each is nil. (defconst c-lang-variable-inits (cc-eval-when-compile c-lang-variable-inits)) +(defconst c-emacs-variable-inits (cc-eval-when-compile c-emacs-variable-inits)) (defun c-make-init-lang-vars-fun (mode) "Create a function that initializes all the language dependent variables @@ -2841,12 +2864,16 @@ accomplish that conveniently." ;; `c-lang-const' will expand to the evaluated ;; constant immediately in `cl-macroexpand-all' ;; below. - (mapcan - (lambda (init) - `(current-var ',(car init) - ,(car init) ,(cl-macroexpand-all - (elt init 1)))) - (cdr c-lang-variable-inits)))) + (mapcan + (lambda (init) + `(current-var ',(car init) + ,(car init) ,(cl-macroexpand-all + (elt init 1)))) + ;; Note: The following `append' copies the + ;; first argument. That list is small, so + ;; this doesn't matter too much. + (append (cdr c-emacs-variable-inits) + (cdr c-lang-variable-inits))))) ;; This diagnostic message isn't useful for end ;; users, so it's disabled. @@ -2859,7 +2886,8 @@ accomplish that conveniently." (require 'cc-langs) (setq source-eval t) - (let ((init (cdr c-lang-variable-inits))) + (let ((init (append (cdr c-emacs-variable-inits) + (cdr c-lang-variable-inits)))) (while init (setq current-var (caar init)) (set (caar init) (eval (cadar init))) @@ -2867,7 +2895,7 @@ accomplish that conveniently." (error (if current-var - (message "Eval error in the `c-lang-defvar' for `%s'%s: %S" + (message "Eval error in the `c-lang-defvar' or `c-lang-setvar' for `%s'%s: %S" current-var (if source-eval (format "\ @@ -2883,7 +2911,8 @@ accomplish that conveniently." `(lambda () (require 'cc-langs) (let ((c-buffer-is-cc-mode ',mode) - (init (cdr c-lang-variable-inits)) + (init (append (cdr c-emacs-variable-inits) + (cdr c-lang-variable-inits))) current-var) (condition-case err @@ -2895,7 +2924,7 @@ accomplish that conveniently." (error (if current-var (message - "Eval error in the `c-lang-defvar' for `%s' (source eval): %S" + "Eval error in the `c-lang-defvar' or `c-lang-setver' for `%s' (source eval): %S" current-var err) (signal (car err) (cdr err))))))) )) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 7343ec735ea..eb5ae4b63b6 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -153,12 +153,21 @@ (defun c-leave-cc-mode-mode () (setq c-buffer-is-cc-mode nil)) +;; Make the `c-lang-setvar' variables buffer local in the current buffer. +;; These are typically standard emacs variables such as `comment-start'. +(defmacro c-make-emacs-variables-local () + `(progn + ,@(mapcan (lambda (init) + `((make-local-variable ',(car init)))) + (cdr c-emacs-variable-inits)))) + (defun c-init-language-vars-for (mode) "Initialize the language variables for one of the language modes directly supported by CC Mode. This can be used instead of the `c-init-language-vars' macro if the language you want to use is one of those, rather than a derived language defined through the language variable system (see \"cc-langs.el\")." + (c-make-emacs-variables-local) (cond ((eq mode 'c-mode) (c-init-language-vars c-mode)) ((eq mode 'c++-mode) (c-init-language-vars c++-mode)) ((eq mode 'objc-mode) (c-init-language-vars objc-mode)) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 3c63d5f01b1..e8c09113d39 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -226,14 +226,19 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) ;; I have no idea what this first line is supposed to match, but it ;; makes things ambiguous with output such as "foo:344:50:blabla" since ;; the "foo" part can match this first line (in which case the file - ;; name as "344"). To avoid this, we disallow filenames exclusively - ;; composed of digits. --Stef + ;; name as "344"). To avoid this, the second line disallows filenames + ;; exclusively composed of digits. --Stef + ;; Similarly, we get lots of false positives with messages including + ;; times of the form "HH:MM:SS" where MM is taken as a line number, so + ;; the last line tries to rule out message where the info after the + ;; line number starts with "SS". --Stef "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\)?\ \\([0-9]*[^0-9\n].*?\\): ?\ \\([0-9]+\\)\\(?:\\([.:]\\)\\([0-9]+\\)\\)?\ \\(?:-\\([0-9]+\\)?\\(?:\\3\\([0-9]+\\)\\)?\\)?:\ \\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ - *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\)\\)?" + *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\)\\|\ +\[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)" 1 (2 . 5) (4 . 6) (7 . 8)) (lcc @@ -405,10 +410,7 @@ you may also want to change `compilation-page-delimiter'.") "Value of `page-delimiter' in Compilation mode.") (defvar compilation-mode-font-lock-keywords - '(;; Don't highlight this as a compilation message. - ("^Compilation started at.*" - (0 '(face nil message nil help-echo nil mouse-face nil) t)) - ;; configure output lines. + '(;; configure output lines. ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to \\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: .+\\)?\\)\\|no\\|\\(.*\\)\\)$" (1 font-lock-variable-name-face) (2 (compilation-face '(4 . 3)))) @@ -419,7 +421,7 @@ you may also want to change `compilation-page-delimiter'.") ("^Compilation \\(finished\\).*" (0 '(face nil message nil help-echo nil mouse-face nil) t) (1 compilation-info-face)) - ("^Compilation \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" + ("^Compilation \\(exited abnormally\\|interrupt\\|killed\\|terminated\\|segmentation fault\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" (0 '(face nil message nil help-echo nil mouse-face nil) t) (1 compilation-error-face) (2 compilation-error-face nil t))) @@ -1823,28 +1825,44 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." (find-file-noselect name)) fmts (cdr fmts))) (setq dirs (cdr dirs))) - (or buffer - ;; The file doesn't exist. Ask the user where to find it. - (save-excursion ;This save-excursion is probably not right. - (let ((pop-up-windows t)) - (compilation-set-window (display-buffer (marker-buffer marker)) - marker) - (let ((name (expand-file-name - (read-file-name - (format "Find this %s in (default %s): " - compilation-error filename) - spec-dir filename t)))) - (if (file-directory-p name) - (setq name (expand-file-name filename name))) - (setq buffer (and (file-exists-p name) - (find-file-noselect name))))))) + (while (null buffer) ;Repeat until the user selects an existing file. + ;; The file doesn't exist. Ask the user where to find it. + (save-excursion ;This save-excursion is probably not right. + (let ((pop-up-windows t)) + (compilation-set-window (display-buffer (marker-buffer marker)) + marker) + (let* ((name (read-file-name + (format "Find this %s in (default %s): " + compilation-error filename) + spec-dir filename t nil + ;; Try to make sure the user can only select + ;; a valid answer. This predicate may be ignored, + ;; tho, so we still have to double-check afterwards. + ;; TODO: We should probably fix read-file-name so + ;; that it never ignores this predicate, even when + ;; using popup dialog boxes. + (lambda (name) + (if (file-directory-p name) + (setq name (expand-file-name filename name))) + (file-exists-p name)))) + (origname name)) + (cond + ((not (file-exists-p name)) + (message "Cannot find file `%s'" name) + (ding) (sit-for 2)) + ((and (file-directory-p name) + (not (file-exists-p + (setq name (expand-file-name filename name))))) + (message "No `%s' in directory %s" filename origname) + (ding) (sit-for 2)) + (t + (setq buffer (find-file-noselect name)))))))) ;; Make intangible overlays tangible. - ;; This is very weird: it's not even clear which is the current buffer, - ;; so the code below can't be expected to DTRT here. --Stef - (mapcar (function (lambda (ov) - (when (overlay-get ov 'intangible) - (overlay-put ov 'intangible nil)))) - (overlays-in (point-min) (point-max))) + ;; This is weird: it's not even clear which is the current buffer, + ;; so the code below can't be expected to DTRT here. -- Stef + (dolist (ov (overlays-in (point-min) (point-max))) + (when (overlay-get ov 'intangible) + (overlay-put ov 'intangible nil))) buffer)) (defun compilation-get-file-structure (file &optional fmt) diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el index 03ab24adf47..44a192ab772 100644 --- a/lisp/progmodes/delphi.el +++ b/lisp/progmodes/delphi.el @@ -1767,6 +1767,7 @@ it is a routine." An error is raised if not in a comment." (interactive) (save-excursion + (save-restriction (let* ((comment (delphi-current-token)) (comment-kind (delphi-token-kind comment))) (if (not (delphi-is comment-kind delphi-comments)) @@ -1845,7 +1846,7 @@ An error is raised if not in a comment." ;; React to the entire fill change as a whole. (delphi-progress-start) (delphi-parse-region comment-start comment-end) - (delphi-progress-done)))))) + (delphi-progress-done))))))) (defun delphi-new-comment-line () "If in a // comment, does a newline, indented such that one is still in the diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 810a7b3e973..dca6fa16df0 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -434,7 +434,8 @@ With arg, use separate IO iff arg is positive." (make-local-variable 'gdb-define-alist) (gdb-create-define-alist) (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) - (gdb-force-mode-line-update "ready")) + (gdb-force-mode-line-update + (propertize "ready" 'face font-lock-variable-name-face))) (defun gdb-find-watch-expression () (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) @@ -1209,7 +1210,8 @@ This filter may simply queue input for a later time." (defun gdb-resync() (setq gdb-flush-pending-output t) (setq gud-running nil) - (gdb-force-mode-line-update "stopped") + (gdb-force-mode-line-update + (propertize "stopped"'face font-lock-warning-face)) (setq gdb-output-sink 'user) (setq gdb-input-queue nil) (setq gdb-pending-triggers nil) @@ -1249,7 +1251,8 @@ happens to be in effect." "An annotation handler for `prompt'. This sends the next command (if any) to gdb." (when gdb-first-prompt - (gdb-force-mode-line-update "initializing...") + (gdb-force-mode-line-update + (propertize "initializing..." 'face font-lock-variable-name-face)) (gdb-init-1) (setq gdb-first-prompt nil)) (let ((sink gdb-output-sink)) @@ -1287,7 +1290,8 @@ not GDB." (progn (setq gud-running t) (setq gdb-inferior-status "running") - (gdb-force-mode-line-update gdb-inferior-status) + (gdb-force-mode-line-update + (propertize gdb-inferior-status 'face font-lock-type-face)) (gdb-remove-text-properties) (setq gud-old-arrow gud-overlay-arrow-position) (setq gud-overlay-arrow-position nil) @@ -1300,7 +1304,8 @@ not GDB." (defun gdb-signal (ignored) (setq gdb-inferior-status "signal") - (gdb-force-mode-line-update gdb-inferior-status) + (gdb-force-mode-line-update + (propertize gdb-inferior-status 'face font-lock-warning-face)) (gdb-stopping ignored)) (defun gdb-stopping (ignored) @@ -1327,7 +1332,8 @@ directives." (setq gdb-overlay-arrow-position nil) (setq gud-old-arrow nil) (setq gdb-inferior-status "exited") - (gdb-force-mode-line-update gdb-inferior-status) + (gdb-force-mode-line-update + (propertize gdb-inferior-status 'face font-lock-warning-face)) (gdb-stopping ignored)) (defun gdb-signalled (ignored) @@ -1375,7 +1381,8 @@ sink to `user' in `gdb-stopping', that is fine." 'delete))))) (unless (member gdb-inferior-status '("exited" "signal")) (setq gdb-inferior-status "stopped") - (gdb-force-mode-line-update gdb-inferior-status)) + (gdb-force-mode-line-update + (propertize gdb-inferior-status 'face font-lock-warning-face))) (let ((sink gdb-output-sink)) (cond ((eq sink 'inferior) @@ -3268,7 +3275,8 @@ is set in them." (make-local-variable 'gdb-define-alist) (gdb-create-define-alist) (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))) - (gdb-force-mode-line-update "ready")) + (gdb-force-mode-line-update + (propertize "ready" 'face font-lock-variable-name-face))) ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. (defun gdb-var-list-children-1 (varnum) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 37d4952058b..e7d85910a63 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -155,7 +155,7 @@ The following place holders should be present in the string: :type 'alist :group 'grep) -(defcustom grep-find-ignored-directories '("CVS" ".hg" "{arch}") +(defcustom grep-find-ignored-directories '("CVS" ".svn" "{arch}" ".hg" "_darcs") "*List of names of sub-directories which `rgrep' shall not recurse into." :type '(repeat string) :group 'grep) diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index bdc8161c80f..f4c117fd935 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -4384,7 +4384,7 @@ idlwave-shell-electric-debug-mode-map) ["Edit Default Cmd" idlwave-shell-edit-default-command-line t]) ("Breakpoints" ["Set Breakpoint" idlwave-shell-break-here - :keys "C-c C-d C-c" :active (eq major-mode 'idlwave-mode)] + :keys "C-c C-d C-b" :active (eq major-mode 'idlwave-mode)] ("Set Special Breakpoint" ["Set After Count Breakpoint" (progn diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el index ec12468e5d9..4f0159c5992 100644 --- a/lisp/progmodes/ld-script.el +++ b/lisp/progmodes/ld-script.el @@ -74,25 +74,55 @@ "Syntax table used while in `ld-script-mode'.") ;; Font lock keywords +;; (The section number comes from ld's info.) (defvar ld-script-keywords - '("ENTRY" "INCLUDE" "INPUT" "GROUP" - "OUTPUT" "SEARCH_DIR" "STARTUP" + '( + ;; 3.4.1 Setting the Entry Point + "ENTRY" + ;; 3.4.2 Commands Dealing with Files + "INCLUDE" "INPUT" "GROUP" "AS_NEEDED" "OUTPUT" "SEARCH_DIR" "STARTUP" + ;; 3.4.3 Commands Dealing with Object File Formats "OUTPUT_FORMAT" "TARGET" - "ASSERT" "EXTERN" "FORCE_COMMON_ALLOCATION" "NOCROSSREFS" "OUTPUT_ARCH" + ;; 3.4.3 Other Linker Script Commands + "ASSERT" "EXTERN" "FORCE_COMMON_ALLOCATION" + "INHIBIT_COMMON_ALLOCATION" "NOCROSSREFS" "OUTPUT_ARCH" + ;; 3.5.2 PROVIDE "PROVIDE" - "SECTIONS" "SORT" "COMMON" "KEEP" - "BYTE" "SHORT" "LONG" "QUAD" "SQAD" - "FILL" - "CREATE_OBJECT_SYMBOLS" - "CONSTRUCTORS" + ;; 3.5.3 PROVIDE_HIDDEN + "PROVIDE_HIDEN" + ;; 3.6 SECTIONS Command + "SECTIONS" + ;; 3.6.4.2 Input Section Wildcard Patterns + "SORT" "SORT_BY_NAME" "SORT_BY_ALIGNMENT" + ;; 3.6.4.3 Input Section for Common Symbols + "COMMON" + ;; 3.6.4.4 Input Section and Garbage Collection + "KEEP" + ;; 3.6.5 Output Section Data + "BYTE" "SHORT" "LONG" "QUAD" "SQUAD" "FILL" + ;; 3.6.6 Output Section Keywords + "CREATE_OBJECT_SYMBOLS" "CONSTRUCTORS" + "__CTOR_LIST__" "__CTOR_END__" "__DTOR_LIST__" "__DTOR_END__" + ;; 3.6.7 Output Section Discarding + ;; See `ld-script-font-lock-keywords' + ;; 3.6.8.1 Output Section Type "NOLOAD" "DSECT" "COPY" "INFO" "OVERLAY" + ;; 3.6.8.2 Output Section LMA "AT" + ;; 3.6.8.4 Forced Input Alignment + "SUBALIGN" + ;; 3.6.8.6 Output Section Phdr + ":PHDR" + ;; 3.7 MEMORY Command "MEMORY" + ;; 3.8 PHDRS Command "PHDRS" "FILEHDR" "FLAGS" "PT_NULL" "PT_LOAD" "PT_DYNAMIC" "PT_INTERP" "PT_NONE" "PT_SHLIB" "PT_PHDR" + ;; 3.9 VERSION Command "VERSION") "Keywords used of GNU ld script.") +;; 3.10.8 Builtin Functions (defvar ld-script-builtins '("ABSOLUTE" "ADDR" @@ -102,12 +132,12 @@ "DATA_SEGMENT_END" "DATA_SEGMENT_RELRO_END" "DEFINED" - "LENGTH" + "LENGTH" "len" "l" "LOADADDR" "MAX" "MIN" "NEXT" - "ORIGIN" + "ORIGIN" "org" "o" "SEGMENT_START" "SIZEOF" "SIZEOF_HEADERS" @@ -120,7 +150,10 @@ 1 font-lock-keyword-face) (,(regexp-opt ld-script-builtins 'words) 1 font-lock-builtin-face) - ("/DISCARD/" . font-lock-warning-face) + ;; 3.6.7 Output Section Discarding + ;; 3.6.4.1 Input Section Basics + ;; 3.6.8.6 Output Section Phdr + ("/DISCARD/\\|EXCLUDE_FILE\\|:NONE" . font-lock-warning-face) ("\\W\\(\\.\\)\\W" 1 ld-script-location-counter-face) ) cpp-font-lock-keywords) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index ef80d28c578..6098c8be067 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -980,47 +980,55 @@ Point is at the beginning of the next line." (re-search-forward sh-here-doc-re limit t)) (defun sh-quoted-subshell (limit) - "Search for a subshell embedded in a string. Find all the unescaped -\" characters within said subshell, remembering that subshells can nest." - (if (re-search-forward "\"\\(?:.\\|\n\\)*?\\(\\$(\\|`\\)" limit t) - ;; bingo we have a $( or a ` inside a "" - (let ((char (char-after (point))) - (continue t) - (pos (point)) - (data nil) ;; value to put into match-data (and return) - (last nil) ;; last char seen - (bq (equal (match-string 1) "`")) ;; ` state flip-flop - (seen nil) ;; list of important positions - (nest 1)) ;; subshell nesting level - (while (and continue char (<= pos limit)) - ;; unescaped " inside a $( ... ) construct. - ;; state machine time... - ;; \ => ignore next char; - ;; ` => increase or decrease nesting level based on bq flag - ;; ) [where nesting > 0] => decrease nesting - ;; ( [where nesting > 0] => increase nesting - ;; ( [preceeded by $ ] => increase nesting - ;; " [nesting <= 0 ] => terminate, we're done. - ;; " [nesting > 0 ] => remember this, it's not a proper " - (if (eq ?\\ last) nil - (if (eq ?\` char) (setq nest (+ nest (if bq -1 1)) bq (not bq)) - (if (and (> nest 0) (eq ?\) char)) (setq nest (1- nest)) - (if (and (eq ?$ last) (eq ?\( char)) (setq nest (1+ nest)) - (if (and (> nest 0) (eq ?\( char)) (setq nest (1+ nest)) - (if (eq char ?\") - (if (>= 0 nest) (setq continue nil) - (setq seen (cons pos seen)) ) )))))) - ;;(message "POS: %d [%d]" pos nest) - (setq last char - pos (1+ pos) - char (char-after pos)) ) - (when seen - ;;(message "SEEN: %S" seen) - (setq data (list (current-buffer))) - (mapc (lambda (P) - (setq data (cons P (cons (1+ P) data)) ) ) seen) - (store-match-data data)) - data) )) + "Search for a subshell embedded in a string. +Find all the unescaped \" characters within said subshell, remembering that +subshells can nest." + ;; FIXME: This can (and often does) match multiple lines, yet it makes no + ;; effort to handle multiline cases correctly, so it ends up being + ;; rather flakey. + (when (re-search-forward "\"\\(?:\\(?:.\\|\n\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)" limit t) + ;; bingo we have a $( or a ` inside a "" + (let ((char (char-after (point))) + (continue t) + (pos (point)) + (data nil) ;; value to put into match-data (and return) + (last nil) ;; last char seen + (bq (equal (match-string 1) "`")) ;; ` state flip-flop + (seen nil) ;; list of important positions + (nest 1)) ;; subshell nesting level + (while (and continue char (<= pos limit)) + ;; unescaped " inside a $( ... ) construct. + ;; state machine time... + ;; \ => ignore next char; + ;; ` => increase or decrease nesting level based on bq flag + ;; ) [where nesting > 0] => decrease nesting + ;; ( [where nesting > 0] => increase nesting + ;; ( [preceeded by $ ] => increase nesting + ;; " [nesting <= 0 ] => terminate, we're done. + ;; " [nesting > 0 ] => remember this, it's not a proper " + ;; FIXME: don't count parens that appear within quotes. + (cond + ((eq ?\\ last) nil) + ((eq ?\` char) (setq nest (+ nest (if bq -1 1)) bq (not bq))) + ((and (> nest 0) (eq ?\) char)) (setq nest (1- nest))) + ((and (eq ?$ last) (eq ?\( char)) (setq nest (1+ nest))) + ((and (> nest 0) (eq ?\( char)) (setq nest (1+ nest))) + ((eq char ?\") + (if (>= 0 nest) (setq continue nil) (push pos seen)))) + ;;(message "POS: %d [%d]" pos nest) + (setq last char + pos (1+ pos) + char (char-after pos)) ) + ;; FIXME: why construct a costly match data to pass to + ;; sh-apply-quoted-subshell rather than apply the highlight + ;; directly here? -- Stef + (when seen + ;;(message "SEEN: %S" seen) + (setq data (list (current-buffer))) + (dolist(P seen) + (setq data (cons P (cons (1+ P) data)))) + (store-match-data data)) + data) )) (defun sh-is-quoted-p (pos) (and (eq (char-before pos) ?\\) diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 8ca7eb188ec..b622e536d26 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -262,11 +262,11 @@ It calls them sequentially, and if any returns non-nil, (defun which-function () "Return current function name based on point. -Uses `which-function-functions', `imenu--index-alist' +Uses `which-func-functions', `imenu--index-alist' or `add-log-current-defun-function'. If no function name is found, return nil." (let ((name - ;; Try the `which-function-functions' functions first. + ;; Try the `which-func-functions' functions first. (run-hook-with-args-until-success 'which-func-functions))) ;; If Imenu is loaded, try to make an index alist with it. |