diff options
| author | Tom Tromey | 2013-08-19 21:53:07 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-08-19 21:53:07 -0600 |
| commit | 6d75555c5cc3d2a629646cee7629e67530fa7a36 (patch) | |
| tree | 3852804dd234ad613ea8691332e10b92c027e87d /lisp/progmodes | |
| parent | cc231cbe45d27a1906d268fb72d3b4105a2e9c65 (diff) | |
| parent | 8c2f38aaab7a7a2f0605416fc2ee38701e41ab61 (diff) | |
| download | emacs-6d75555c5cc3d2a629646cee7629e67530fa7a36.tar.gz emacs-6d75555c5cc3d2a629646cee7629e67530fa7a36.zip | |
merge from trunk
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/ada-mode.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/ada-xref.el | 16 | ||||
| -rw-r--r-- | lisp/progmodes/bat-mode.el | 185 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 13 | ||||
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 15 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/ebrowse.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/etags.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/f90.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/fortran.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/gdb-mi.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/idlw-toolbar.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/js.el | 7 | ||||
| -rw-r--r-- | lisp/progmodes/mixal-mode.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 114 | ||||
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 2 |
17 files changed, 267 insertions, 115 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index 805444d08b9..33b21d6cc07 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el | |||
| @@ -130,6 +130,8 @@ | |||
| 130 | (defvar ispell-check-comments) | 130 | (defvar ispell-check-comments) |
| 131 | (defvar skeleton-further-elements) | 131 | (defvar skeleton-further-elements) |
| 132 | 132 | ||
| 133 | (define-error 'ada-mode-errors nil) | ||
| 134 | |||
| 133 | (defun ada-mode-version () | 135 | (defun ada-mode-version () |
| 134 | "Return Ada mode version." | 136 | "Return Ada mode version." |
| 135 | (interactive) | 137 | (interactive) |
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index e44b7c191bf..d29fa8c1d36 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el | |||
| @@ -1142,7 +1142,7 @@ If OTHER-FRAME is non-nil, display the cross-reference in another frame." | |||
| 1142 | (condition-case err | 1142 | (condition-case err |
| 1143 | (ada-find-in-ali identlist other-frame) | 1143 | (ada-find-in-ali identlist other-frame) |
| 1144 | ;; File not found: print explicit error message | 1144 | ;; File not found: print explicit error message |
| 1145 | (error-file-not-found | 1145 | (ada-error-file-not-found |
| 1146 | (message (concat (error-message-string err) | 1146 | (message (concat (error-message-string err) |
| 1147 | (nthcdr 1 err)))) | 1147 | (nthcdr 1 err)))) |
| 1148 | 1148 | ||
| @@ -1637,7 +1637,7 @@ Search in project file for possible paths." | |||
| 1637 | (let ((filename (ada-find-src-file-in-dir file))) | 1637 | (let ((filename (ada-find-src-file-in-dir file))) |
| 1638 | (if filename | 1638 | (if filename |
| 1639 | (expand-file-name filename) | 1639 | (expand-file-name filename) |
| 1640 | (signal 'error-file-not-found (file-name-nondirectory file))) | 1640 | (signal 'ada-error-file-not-found (file-name-nondirectory file))) |
| 1641 | ))) | 1641 | ))) |
| 1642 | 1642 | ||
| 1643 | (defun ada-find-file-number-in-ali (file) | 1643 | (defun ada-find-file-number-in-ali (file) |
| @@ -1828,7 +1828,7 @@ Information is extracted from the ali file." | |||
| 1828 | (ada-file-of identlist))) | 1828 | (ada-file-of identlist))) |
| 1829 | 1829 | ||
| 1830 | ;; Else clean up the ali file | 1830 | ;; Else clean up the ali file |
| 1831 | (error-file-not-found | 1831 | (ada-error-file-not-found |
| 1832 | (signal (car err) (cdr err))) | 1832 | (signal (car err) (cdr err))) |
| 1833 | (error | 1833 | (error |
| 1834 | (kill-buffer ali-buffer) | 1834 | (kill-buffer ali-buffer) |
| @@ -2127,7 +2127,7 @@ the declaration and documentation of the subprograms one is using." | |||
| 2127 | (string-to-number (nth 2 (nth choice list))) | 2127 | (string-to-number (nth 2 (nth choice list))) |
| 2128 | identlist | 2128 | identlist |
| 2129 | other-frame) | 2129 | other-frame) |
| 2130 | (signal 'error-file-not-found (car (nth choice list)))) | 2130 | (signal 'ada-error-file-not-found (car (nth choice list)))) |
| 2131 | (message "This is only a (good) guess at the cross-reference.") | 2131 | (message "This is only a (good) guess at the cross-reference.") |
| 2132 | )))) | 2132 | )))) |
| 2133 | 2133 | ||
| @@ -2362,12 +2362,8 @@ For instance, it creates the gnat-specific menus, sets some hooks for | |||
| 2362 | (add-hook 'ada-mode-hook 'ada-xref-initialize) | 2362 | (add-hook 'ada-mode-hook 'ada-xref-initialize) |
| 2363 | 2363 | ||
| 2364 | ;; Define a new error type | 2364 | ;; Define a new error type |
| 2365 | (put 'error-file-not-found | 2365 | (define-error 'ada-error-file-not-found |
| 2366 | 'error-conditions | 2366 | "File not found in src-dir (check project file): " 'ada-mode-errors) |
| 2367 | '(error ada-mode-errors error-file-not-found)) | ||
| 2368 | (put 'error-file-not-found | ||
| 2369 | 'error-message | ||
| 2370 | "File not found in src-dir (check project file): ") | ||
| 2371 | 2367 | ||
| 2372 | (provide 'ada-xref) | 2368 | (provide 'ada-xref) |
| 2373 | 2369 | ||
diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el new file mode 100644 index 00000000000..2b6f9d3434d --- /dev/null +++ b/lisp/progmodes/bat-mode.el | |||
| @@ -0,0 +1,185 @@ | |||
| 1 | ;;; bat-mode.el --- Major mode for editing DOS/Windows scripts | ||
| 2 | |||
| 3 | ;; Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Arni Magnusson <arnima@hafro.is> | ||
| 6 | ;; Keywords: languages | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Commentary: | ||
| 24 | ;; | ||
| 25 | ;; Major mode for editing DOS/Windows scripts (batch files). Provides syntax | ||
| 26 | ;; highlighting, a basic template, access to DOS help pages, imenu/outline | ||
| 27 | ;; navigation, and the ability to run scripts from within Emacs. The syntax | ||
| 28 | ;; groups for highlighting are: | ||
| 29 | ;; | ||
| 30 | ;; Face Example | ||
| 31 | ;; bat-label-face :LABEL | ||
| 32 | ;; font-lock-comment-face rem | ||
| 33 | ;; font-lock-builtin-face copy | ||
| 34 | ;; font-lock-keyword-face goto | ||
| 35 | ;; font-lock-warning-face cp | ||
| 36 | ;; font-lock-constant-face [call] prog | ||
| 37 | ;; font-lock-variable-name-face %var% | ||
| 38 | ;; font-lock-type-face -option | ||
| 39 | ;; | ||
| 40 | ;; Usage: | ||
| 41 | ;; | ||
| 42 | ;; See documentation of function `bat-mode'. | ||
| 43 | ;; | ||
| 44 | ;; Separate package `dos-indent' (Matthew Fidler) provides rudimentary | ||
| 45 | ;; indentation, see http://www.emacswiki.org/emacs/dos-indent.el. | ||
| 46 | ;; | ||
| 47 | ;; Acknowledgements: | ||
| 48 | ;; | ||
| 49 | ;; Inspired by `batch-mode' (Agnar Renolen) and `cmd-mode' (Tadamegu Furukawa). | ||
| 50 | |||
| 51 | ;;; Code: | ||
| 52 | |||
| 53 | ;; 1 Preamble | ||
| 54 | |||
| 55 | (defgroup bat-mode nil | ||
| 56 | "Major mode for editing DOS/Windows batch files." | ||
| 57 | :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) | ||
| 58 | :group 'languages) | ||
| 59 | |||
| 60 | ;; 2 User variables | ||
| 61 | |||
| 62 | (defface bat-label-face '((t :weight bold)) | ||
| 63 | "Font Lock mode face used to highlight labels in batch files.") | ||
| 64 | |||
| 65 | ;; 3 Internal variables | ||
| 66 | |||
| 67 | (defvar bat-font-lock-keywords | ||
| 68 | (eval-when-compile | ||
| 69 | (let ((COMMANDS | ||
| 70 | '("assoc" "at" "attrib" "cd" "cls" "color" "copy" "date" "del" "dir" | ||
| 71 | "doskey" "echo" "endlocal" "erase" "fc" "find" "findstr" "format" | ||
| 72 | "ftype" "label" "md" "mkdir" "more" "move" "net" "path" "pause" | ||
| 73 | "popd" "prompt" "pushd" "rd" "ren" "rename" "replace" "rmdir" "set" | ||
| 74 | "setlocal" "shift" "sort" "subst" "time" "title" "tree" "type" | ||
| 75 | "ver" "vol" "xcopy")) | ||
| 76 | (CONTROLFLOW | ||
| 77 | '("call" "cmd" "defined" "do" "else" "equ" "exist" "exit" "for" "geq" | ||
| 78 | "goto" "gtr" "if" "in" "leq" "lss" "neq" "not" "start")) | ||
| 79 | (UNIX | ||
| 80 | '("bash" "cat" "cp" "fgrep" "grep" "ls" "sed" "sh" "mv" "rm"))) | ||
| 81 | `(("\\<_\\(call\\|goto\\)\\_>[ \t]+%?\\([A-Za-z0-9-_\\:.]+\\)%?" | ||
| 82 | (2 font-lock-constant-face t)) | ||
| 83 | ("^:[^:].*" | ||
| 84 | . 'bat-label-face) | ||
| 85 | ("\\<_\\(defined\\|set\\)\\_>[ \t]*\\(\\w+\\)" | ||
| 86 | (2 font-lock-variable-name-face)) | ||
| 87 | ("%\\(\\w+\\)%?" | ||
| 88 | (1 font-lock-variable-name-face)) | ||
| 89 | ("!\\(\\w+\\)!?" ; delayed-expansion !variable! | ||
| 90 | (1 font-lock-variable-name-face)) | ||
| 91 | ("[ =][-/]+\\(\\w+\\)" | ||
| 92 | (1 font-lock-type-face append)) | ||
| 93 | (,(concat "\\_<" (regexp-opt COMMANDS) "\\_>") . font-lock-builtin-face) | ||
| 94 | (,(concat "\\_<" (regexp-opt CONTROLFLOW) "\\_>") | ||
| 95 | . font-lock-keyword-face) | ||
| 96 | (,(concat "\\_<" (regexp-opt UNIX) "\\_>") | ||
| 97 | . font-lock-warning-face))))) | ||
| 98 | |||
| 99 | (defvar bat-menu | ||
| 100 | '("Bat" | ||
| 101 | ["Run" bat-run :help "Run script"] | ||
| 102 | ["Run with Args" bat-run-args :help "Run script with args"] | ||
| 103 | "--" | ||
| 104 | ["Imenu" imenu :help "Navigate with imenu"] | ||
| 105 | "--" | ||
| 106 | ["Template" bat-template :help "Insert template"] | ||
| 107 | "--" | ||
| 108 | ["Help (Command)" bat-cmd-help :help "Show help page for DOS command"])) | ||
| 109 | |||
| 110 | (defvar bat-mode-map | ||
| 111 | (let ((map (make-sparse-keymap))) | ||
| 112 | (easy-menu-define nil map nil bat-menu) | ||
| 113 | (define-key map [?\C-c ?\C-/] 'bat-cmd-help) ;FIXME: Why not C-c C-? ? | ||
| 114 | (define-key map [?\C-c ?\C-a] 'bat-run-args) | ||
| 115 | (define-key map [?\C-c ?\C-c] 'bat-run) | ||
| 116 | (define-key map [?\C-c ?\C-t] 'bat-template) | ||
| 117 | (define-key map [?\C-c ?\C-v] 'bat-run) | ||
| 118 | map)) | ||
| 119 | |||
| 120 | (defvar bat-mode-syntax-table | ||
| 121 | (let ((table (make-syntax-table))) | ||
| 122 | (modify-syntax-entry ?\n ">" table) | ||
| 123 | ;; Beware: `w' should not be used for non-alphabetic chars. | ||
| 124 | (modify-syntax-entry ?~ "_" table) | ||
| 125 | (modify-syntax-entry ?% "." table) | ||
| 126 | (modify-syntax-entry ?- "_" table) | ||
| 127 | (modify-syntax-entry ?_ "_" table) | ||
| 128 | ;; FIXME: { and } can appear in identifiers? Really? | ||
| 129 | (modify-syntax-entry ?{ "_" table) | ||
| 130 | (modify-syntax-entry ?} "_" table) | ||
| 131 | (modify-syntax-entry ?\\ "." table) | ||
| 132 | table)) | ||
| 133 | |||
| 134 | (defconst bat--syntax-propertize | ||
| 135 | (syntax-propertize-rules | ||
| 136 | ("^[ \t]*\\(?:\\(@?r\\)em\\_>\\|\\(?1::\\):\\).*" (1 "<")))) | ||
| 137 | |||
| 138 | ;; 4 User functions | ||
| 139 | |||
| 140 | (defun bat-cmd-help (cmd) | ||
| 141 | "Show help for batch file command CMD." | ||
| 142 | (interactive "sHelp: ") | ||
| 143 | (if (string-equal cmd "net") | ||
| 144 | ;; FIXME: liable to quoting nightmare. Use call-process? | ||
| 145 | (shell-command "net /?") (shell-command (concat "help " cmd)))) | ||
| 146 | |||
| 147 | (defun bat-run () | ||
| 148 | "Run a batch file." | ||
| 149 | (interactive) | ||
| 150 | ;; FIXME: liable to quoting nightmare. Use call/start-process? | ||
| 151 | (save-buffer) (shell-command buffer-file-name)) | ||
| 152 | |||
| 153 | (defun bat-run-args (args) | ||
| 154 | "Run a batch file with ARGS." | ||
| 155 | (interactive "sArgs: ") | ||
| 156 | ;; FIXME: Use `compile'? | ||
| 157 | (shell-command (concat buffer-file-name " " args))) | ||
| 158 | |||
| 159 | (defun bat-template () | ||
| 160 | "Insert minimal batch file template." | ||
| 161 | (interactive) | ||
| 162 | (goto-char (point-min)) (insert "@echo off\nsetlocal\n\n")) | ||
| 163 | |||
| 164 | ;;;###autoload | ||
| 165 | (add-to-list 'auto-mode-alist '("\\.\\(bat\\|cmd\\)\\'" . bat-mode)) | ||
| 166 | |||
| 167 | ;; 5 Main function | ||
| 168 | |||
| 169 | ;;;###autoload | ||
| 170 | (define-derived-mode bat-mode prog-mode "Bat" | ||
| 171 | "Major mode for editing DOS/Windows batch files.\n | ||
| 172 | Start a new script from `bat-template'. Read help pages for DOS commands | ||
| 173 | with `bat-cmd-help'. Navigate between sections using `imenu'. | ||
| 174 | Run script using `bat-run' and `bat-run-args'.\n | ||
| 175 | \\{bat-mode-map}" | ||
| 176 | (setq-local comment-start "rem ") | ||
| 177 | (setq-local syntax-propertize-function bat--syntax-propertize) | ||
| 178 | (setq-local font-lock-defaults | ||
| 179 | '(bat-font-lock-keywords nil t)) ; case-insensitive keywords | ||
| 180 | (setq-local imenu-generic-expression '((nil "^:[^:].*" 0))) | ||
| 181 | (setq-local outline-regexp ":[^:]")) | ||
| 182 | |||
| 183 | (provide 'bat-mode) | ||
| 184 | |||
| 185 | ;;; bat-mode.el ends here | ||
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index a3bd000a4f3..c2ff5011a0e 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -1135,9 +1135,13 @@ comment at the start of cc-engine.el for more info." | |||
| 1135 | (not (memq sym '(boundary ignore nil)))) | 1135 | (not (memq sym '(boundary ignore nil)))) |
| 1136 | ;; Need to investigate closer whether we've crossed | 1136 | ;; Need to investigate closer whether we've crossed |
| 1137 | ;; between a substatement and its containing statement. | 1137 | ;; between a substatement and its containing statement. |
| 1138 | (if (setq saved (if (looking-at c-block-stmt-1-key) | 1138 | (if (setq saved |
| 1139 | ptok | 1139 | (cond ((and (looking-at c-block-stmt-1-2-key) |
| 1140 | pptok)) | 1140 | (eq (char-after ptok) ?\()) |
| 1141 | pptok) | ||
| 1142 | ((looking-at c-block-stmt-1-key) | ||
| 1143 | ptok) | ||
| 1144 | (t pptok))) | ||
| 1141 | (cond ((> start saved) (setq pos saved)) | 1145 | (cond ((> start saved) (setq pos saved)) |
| 1142 | ((= start saved) (setq ret 'up))))) | 1146 | ((= start saved) (setq ret 'up))))) |
| 1143 | 1147 | ||
| @@ -7988,7 +7992,8 @@ comment at the start of cc-engine.el for more info." | |||
| 7988 | (or (looking-at c-block-stmt-1-key) | 7992 | (or (looking-at c-block-stmt-1-key) |
| 7989 | (and (eq (char-after) ?\() | 7993 | (and (eq (char-after) ?\() |
| 7990 | (zerop (c-backward-token-2 1 t lim)) | 7994 | (zerop (c-backward-token-2 1 t lim)) |
| 7991 | (looking-at c-block-stmt-2-key))) | 7995 | (or (looking-at c-block-stmt-2-key) |
| 7996 | (looking-at c-block-stmt-1-2-key)))) | ||
| 7992 | (point)))) | 7997 | (point)))) |
| 7993 | 7998 | ||
| 7994 | (defun c-after-special-operator-id (&optional lim) | 7999 | (defun c-after-special-operator-id (&optional lim) |
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 6a4bfd9e875..4e8ce6bac28 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1307,7 +1307,8 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1307 | (goto-char match-pos) | 1307 | (goto-char match-pos) |
| 1308 | (backward-char) | 1308 | (backward-char) |
| 1309 | (c-backward-token-2) | 1309 | (c-backward-token-2) |
| 1310 | (looking-at c-block-stmt-2-key))) | 1310 | (or (looking-at c-block-stmt-2-key) |
| 1311 | (looking-at c-block-stmt-1-2-key)))) | ||
| 1311 | (setq context nil | 1312 | (setq context nil |
| 1312 | c-restricted-<>-arglists t)) | 1313 | c-restricted-<>-arglists t)) |
| 1313 | ;; Near BOB. | 1314 | ;; Near BOB. |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index af52ad53aad..2c0a1317b04 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -2187,6 +2187,18 @@ identifiers that follows the type in a normal declaration." | |||
| 2187 | t (c-make-keywords-re t (c-lang-const c-block-stmt-1-kwds))) | 2187 | t (c-make-keywords-re t (c-lang-const c-block-stmt-1-kwds))) |
| 2188 | (c-lang-defvar c-block-stmt-1-key (c-lang-const c-block-stmt-1-key)) | 2188 | (c-lang-defvar c-block-stmt-1-key (c-lang-const c-block-stmt-1-key)) |
| 2189 | 2189 | ||
| 2190 | (c-lang-defconst c-block-stmt-1-2-kwds | ||
| 2191 | "Statement keywords optionally followed by a paren sexp. | ||
| 2192 | Keywords here should also be in `c-block-stmt-1-kwds'." | ||
| 2193 | t nil | ||
| 2194 | java '("try")) | ||
| 2195 | |||
| 2196 | (c-lang-defconst c-block-stmt-1-2-key | ||
| 2197 | ;; Regexp matching the start of a statement which may be followed by a | ||
| 2198 | ;; paren sexp and will then be followed by a substatement. | ||
| 2199 | t (c-make-keywords-re t (c-lang-const c-block-stmt-1-2-kwds))) | ||
| 2200 | (c-lang-defvar c-block-stmt-1-2-key (c-lang-const c-block-stmt-1-2-key)) | ||
| 2201 | |||
| 2190 | (c-lang-defconst c-block-stmt-2-kwds | 2202 | (c-lang-defconst c-block-stmt-2-kwds |
| 2191 | "Statement keywords followed by a paren sexp and then by a substatement." | 2203 | "Statement keywords followed by a paren sexp and then by a substatement." |
| 2192 | t '("for" "if" "switch" "while") | 2204 | t '("for" "if" "switch" "while") |
| @@ -2938,7 +2950,8 @@ identifier or one of the keywords on `c-<>-type-kwds' or | |||
| 2938 | `c-<>-arglist-kwds'. If there's an identifier before then the whole | 2950 | `c-<>-arglist-kwds'. If there's an identifier before then the whole |
| 2939 | expression is considered to be a type." | 2951 | expression is considered to be a type." |
| 2940 | t (or (consp (c-lang-const c-<>-type-kwds)) | 2952 | t (or (consp (c-lang-const c-<>-type-kwds)) |
| 2941 | (consp (c-lang-const c-<>-arglist-kwds)))) | 2953 | (consp (c-lang-const c-<>-arglist-kwds))) |
| 2954 | java t) | ||
| 2942 | (c-lang-defvar c-recognize-<>-arglists (c-lang-const c-recognize-<>-arglists)) | 2955 | (c-lang-defvar c-recognize-<>-arglists (c-lang-const c-recognize-<>-arglists)) |
| 2943 | 2956 | ||
| 2944 | (c-lang-defconst c-enums-contain-decls | 2957 | (c-lang-defconst c-enums-contain-decls |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index d9c482330cc..8c981b36e56 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -624,7 +624,9 @@ You might also use mode hooks to specify it in certain modes, like this: | |||
| 624 | (file-exists-p \"Makefile\")) | 624 | (file-exists-p \"Makefile\")) |
| 625 | (set (make-local-variable 'compile-command) | 625 | (set (make-local-variable 'compile-command) |
| 626 | (concat \"make -k \" | 626 | (concat \"make -k \" |
| 627 | (file-name-sans-extension buffer-file-name))))))" | 627 | (if buffer-file-name |
| 628 | (shell-quote-argument | ||
| 629 | (file-name-sans-extension buffer-file-name))))))))" | ||
| 628 | :type 'string | 630 | :type 'string |
| 629 | :group 'compilation) | 631 | :group 'compilation) |
| 630 | ;;;###autoload(put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or (not (boundp 'compilation-read-command)) compilation-read-command)))) | 632 | ;;;###autoload(put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or (not (boundp 'compilation-read-command)) compilation-read-command)))) |
| @@ -2492,7 +2494,7 @@ displays at the top of the window; there is no arrow." | |||
| 2492 | All arguments are markers. If END-MK is non-nil, mark is set there | 2494 | All arguments are markers. If END-MK is non-nil, mark is set there |
| 2493 | and overlay is highlighted between MK and END-MK." | 2495 | and overlay is highlighted between MK and END-MK." |
| 2494 | ;; Show compilation buffer in other window, scrolled to this error. | 2496 | ;; Show compilation buffer in other window, scrolled to this error. |
| 2495 | (let* ((from-compilation-buffer (eq (window-buffer (selected-window)) | 2497 | (let* ((from-compilation-buffer (eq (window-buffer) |
| 2496 | (marker-buffer msg))) | 2498 | (marker-buffer msg))) |
| 2497 | ;; Use an existing window if it is in a visible frame. | 2499 | ;; Use an existing window if it is in a visible frame. |
| 2498 | (pre-existing (get-buffer-window (marker-buffer msg) 0)) | 2500 | (pre-existing (get-buffer-window (marker-buffer msg) 0)) |
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index 6a71ab330a8..865211d109c 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el | |||
| @@ -1605,7 +1605,7 @@ specifies where to find/view the result." | |||
| 1605 | ;; Get the source file to view or find. | 1605 | ;; Get the source file to view or find. |
| 1606 | (setf file (ebrowse-find-source-file file tags-file)) | 1606 | (setf file (ebrowse-find-source-file file tags-file)) |
| 1607 | ;; If current window is dedicated, use another frame. | 1607 | ;; If current window is dedicated, use another frame. |
| 1608 | (when (window-dedicated-p (selected-window)) | 1608 | (when (window-dedicated-p) |
| 1609 | (setf where 'other-window)) | 1609 | (setf where 'other-window)) |
| 1610 | (cond (view | 1610 | (cond (view |
| 1611 | (setf ebrowse-temp-position-to-view struc | 1611 | (setf ebrowse-temp-position-to-view struc |
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index ff6321d74c3..a7b7e630bb9 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el | |||
| @@ -982,7 +982,7 @@ See documentation of variable `tags-file-name'." | |||
| 982 | ;; selected window's buffer; without the hair, point is moved in both | 982 | ;; selected window's buffer; without the hair, point is moved in both |
| 983 | ;; windows. To prevent this, we save the selected window's point before | 983 | ;; windows. To prevent this, we save the selected window's point before |
| 984 | ;; doing find-tag-noselect, and restore it after. | 984 | ;; doing find-tag-noselect, and restore it after. |
| 985 | (let* ((window-point (window-point (selected-window))) | 985 | (let* ((window-point (window-point)) |
| 986 | (tagbuf (find-tag-noselect tagname next-p regexp-p)) | 986 | (tagbuf (find-tag-noselect tagname next-p regexp-p)) |
| 987 | (tagpoint (progn (set-buffer tagbuf) (point)))) | 987 | (tagpoint (progn (set-buffer tagbuf) (point)))) |
| 988 | (set-window-point (prog1 | 988 | (set-window-point (prog1 |
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 9bde2900a67..80f663360e4 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el | |||
| @@ -1026,7 +1026,7 @@ Set subexpression 1 in the match-data to the name of the type." | |||
| 1026 | (if (lookup-key (current-local-map) [menu-bar index]) | 1026 | (if (lookup-key (current-local-map) [menu-bar index]) |
| 1027 | (message "%s" "F90-imenu already exists.") | 1027 | (message "%s" "F90-imenu already exists.") |
| 1028 | (imenu-add-to-menubar "F90-imenu") | 1028 | (imenu-add-to-menubar "F90-imenu") |
| 1029 | (redraw-frame (selected-frame)))) | 1029 | (redraw-frame))) |
| 1030 | 1030 | ||
| 1031 | 1031 | ||
| 1032 | ;; Abbrevs have generally two letters, except standard types `c, `i, `r, `t. | 1032 | ;; Abbrevs have generally two letters, except standard types `c, `i, `r, `t. |
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index ff667f80f9d..0fc805aae81 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el | |||
| @@ -1080,8 +1080,7 @@ The next key typed is executed unless it is SPC." | |||
| 1080 | fortran-column-ruler-fixed) | 1080 | fortran-column-ruler-fixed) |
| 1081 | (save-excursion | 1081 | (save-excursion |
| 1082 | (beginning-of-line) | 1082 | (beginning-of-line) |
| 1083 | (if (eq (window-start (selected-window)) | 1083 | (if (eq (window-start) (window-point)) |
| 1084 | (window-point (selected-window))) | ||
| 1085 | (line-beginning-position 2) | 1084 | (line-beginning-position 2) |
| 1086 | (point))) | 1085 | (point))) |
| 1087 | nil "Type SPC or any command to erase ruler.")) | 1086 | nil "Type SPC or any command to erase ruler.")) |
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 4b51a5e7835..2017636435c 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -2951,7 +2951,7 @@ If not in a source or disassembly buffer just set point." | |||
| 2951 | obj) | 2951 | obj) |
| 2952 | (when (numberp pos) | 2952 | (when (numberp pos) |
| 2953 | (with-selected-window (posn-window posn) | 2953 | (with-selected-window (posn-window posn) |
| 2954 | (with-current-buffer (window-buffer (selected-window)) | 2954 | (with-current-buffer (window-buffer) |
| 2955 | (goto-char pos) | 2955 | (goto-char pos) |
| 2956 | (dolist (overlay (overlays-in pos pos)) | 2956 | (dolist (overlay (overlays-in pos pos)) |
| 2957 | (when (overlay-get overlay 'put-break) | 2957 | (when (overlay-get overlay 'put-break) |
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el index d255b8b1a3f..98f9ee3b530 100644 --- a/lisp/progmodes/idlw-toolbar.el +++ b/lisp/progmodes/idlw-toolbar.el | |||
| @@ -962,7 +962,7 @@ static char * file[] = { | |||
| 962 | (if (featurep 'xemacs) | 962 | (if (featurep 'xemacs) |
| 963 | nil ; no action necessary, toolbar gets updated automatically | 963 | nil ; no action necessary, toolbar gets updated automatically |
| 964 | ;; On Emacs, redraw the frame to make sure the Toolbar is updated. | 964 | ;; On Emacs, redraw the frame to make sure the Toolbar is updated. |
| 965 | (redraw-frame (selected-frame)))) | 965 | (redraw-frame))) |
| 966 | 966 | ||
| 967 | (provide 'idlw-toolbar) | 967 | (provide 'idlw-toolbar) |
| 968 | (provide 'idlwave-toolbar) | 968 | (provide 'idlwave-toolbar) |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 28ee859f9db..49a21933133 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -2244,11 +2244,8 @@ current buffer. Pushes a mark onto the tag ring just like | |||
| 2244 | 2244 | ||
| 2245 | ;;; MozRepl integration | 2245 | ;;; MozRepl integration |
| 2246 | 2246 | ||
| 2247 | (put 'js-moz-bad-rpc 'error-conditions '(error timeout)) | 2247 | (define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error)) |
| 2248 | (put 'js-moz-bad-rpc 'error-message "Mozilla RPC Error") | 2248 | (define-error 'js-js-error "Javascript Error") ;; '(js-error error)) |
| 2249 | |||
| 2250 | (put 'js-js-error 'error-conditions '(error js-error)) | ||
| 2251 | (put 'js-js-error 'error-message "Javascript Error") | ||
| 2252 | 2249 | ||
| 2253 | (defun js--wait-for-matching-output | 2250 | (defun js--wait-for-matching-output |
| 2254 | (process regexp timeout &optional start) | 2251 | (process regexp timeout &optional start) |
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el index 8814cdbba35..a14654cdd7c 100644 --- a/lisp/progmodes/mixal-mode.el +++ b/lisp/progmodes/mixal-mode.el | |||
| @@ -1113,8 +1113,10 @@ Assumes that file has been compiled with debugging support." | |||
| 1113 | mixal-syntax-propertize-function) | 1113 | mixal-syntax-propertize-function) |
| 1114 | ;; might add an indent function in the future | 1114 | ;; might add an indent function in the future |
| 1115 | ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) | 1115 | ;; (set (make-local-variable 'indent-line-function) 'mixal-indent-line) |
| 1116 | (set (make-local-variable 'compile-command) (concat "mixasm " | 1116 | (set (make-local-variable 'compile-command) |
| 1117 | buffer-file-name))) | 1117 | (concat "mixasm " |
| 1118 | (if buffer-file-name | ||
| 1119 | (shell-quote-argument buffer-file-name))))) | ||
| 1118 | 1120 | ||
| 1119 | (provide 'mixal-mode) | 1121 | (provide 'mixal-mode) |
| 1120 | 1122 | ||
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 62870f9085b..01833ffd70b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -3042,32 +3042,22 @@ It must be a function with two arguments: TYPE and NAME.") | |||
| 3042 | "*class definition*" | 3042 | "*class definition*" |
| 3043 | "*function definition*")) | 3043 | "*function definition*")) |
| 3044 | 3044 | ||
| 3045 | (defun python-imenu--put-parent (type name pos num-children tree &optional root) | 3045 | (defun python-imenu--put-parent (type name pos tree) |
| 3046 | "Add the parent with TYPE, NAME, POS and NUM-CHILDREN to TREE. | 3046 | "Add the parent with TYPE, NAME and POS to TREE." |
| 3047 | Optional Argument ROOT must be non-nil when the node being | ||
| 3048 | processed is the root of the TREE." | ||
| 3049 | (let ((label | 3047 | (let ((label |
| 3050 | (funcall python-imenu-format-item-label-function type name)) | 3048 | (funcall python-imenu-format-item-label-function type name)) |
| 3051 | (jump-label | 3049 | (jump-label |
| 3052 | (funcall python-imenu-format-parent-item-jump-label-function type name))) | 3050 | (funcall python-imenu-format-parent-item-jump-label-function type name))) |
| 3053 | (if root | 3051 | (if (not tree) |
| 3054 | ;; This is the root, everything is a children. | 3052 | (cons label pos) |
| 3055 | (cons label (cons (cons jump-label pos) tree)) | 3053 | (cons label (cons (cons jump-label pos) tree))))) |
| 3056 | ;; This is node a which may contain some children. | ||
| 3057 | (cons | ||
| 3058 | (cons label (cons (cons jump-label pos) | ||
| 3059 | ;; Append all the children | ||
| 3060 | (python-util-popn tree num-children))) | ||
| 3061 | ;; All previous non-children nodes. | ||
| 3062 | (nthcdr num-children tree))))) | ||
| 3063 | 3054 | ||
| 3064 | (defun python-imenu--build-tree (&optional min-indent prev-indent num-children tree) | 3055 | (defun python-imenu--build-tree (&optional min-indent prev-indent tree) |
| 3065 | "Recursively build the tree of nested definitions of a node. | 3056 | "Recursively build the tree of nested definitions of a node. |
| 3066 | Arguments MIN-INDENT PREV-INDENT NUM-CHILDREN and TREE are | 3057 | Arguments MIN-INDENT PREV-INDENT and TREE are internal and should |
| 3067 | internal and should not be passed explicitly unless you know what | 3058 | not be passed explicitly unless you know what you are doing." |
| 3068 | you are doing." | 3059 | (setq min-indent (or min-indent 0) |
| 3069 | (setq num-children (or num-children 0) | 3060 | prev-indent (or prev-indent python-indent-offset)) |
| 3070 | min-indent (or min-indent 0)) | ||
| 3071 | (let* ((pos (python-nav-backward-defun)) | 3061 | (let* ((pos (python-nav-backward-defun)) |
| 3072 | (type) | 3062 | (type) |
| 3073 | (name (when (and pos (looking-at python-nav-beginning-of-defun-regexp)) | 3063 | (name (when (and pos (looking-at python-nav-beginning-of-defun-regexp)) |
| @@ -3076,73 +3066,33 @@ you are doing." | |||
| 3076 | (cadr split)))) | 3066 | (cadr split)))) |
| 3077 | (label (when name | 3067 | (label (when name |
| 3078 | (funcall python-imenu-format-item-label-function type name))) | 3068 | (funcall python-imenu-format-item-label-function type name))) |
| 3079 | (indent (current-indentation))) | 3069 | (indent (current-indentation)) |
| 3070 | (children-indent-limit (+ python-indent-offset min-indent))) | ||
| 3080 | (cond ((not pos) | 3071 | (cond ((not pos) |
| 3081 | ;; No defun found, nothing to add. | 3072 | ;; Nothing found, probably near to bobp. |
| 3082 | tree) | 3073 | nil) |
| 3083 | ((equal indent 0) | 3074 | ((<= indent min-indent) |
| 3084 | (if (> num-children 0) | 3075 | ;; The current indentation points that this is a parent |
| 3085 | ;; Append it as the parent of everything collected to | 3076 | ;; node, add it to the tree and stop recursing. |
| 3086 | ;; this point. | 3077 | (python-imenu--put-parent type name pos tree)) |
| 3087 | (python-imenu--put-parent type name pos num-children tree t) | ||
| 3088 | ;; There are no children, this is a lonely defun. | ||
| 3089 | (cons label pos))) | ||
| 3090 | ((equal min-indent indent) | ||
| 3091 | ;; Stop collecting nodes after moving to a position with | ||
| 3092 | ;; indentation equaling min-indent. This is specially | ||
| 3093 | ;; useful for navigating nested definitions recursively. | ||
| 3094 | (if (> num-children 0) | ||
| 3095 | tree | ||
| 3096 | ;; When there are no children, the collected tree is a | ||
| 3097 | ;; single node intended to be added in the list of defuns | ||
| 3098 | ;; of its parent. | ||
| 3099 | (car tree))) | ||
| 3100 | (t | 3078 | (t |
| 3101 | (python-imenu--build-tree | 3079 | (python-imenu--build-tree |
| 3102 | min-indent | 3080 | min-indent |
| 3103 | indent | 3081 | indent |
| 3104 | ;; Add another children, either when this is the | 3082 | (if (<= indent children-indent-limit) |
| 3105 | ;; first call or when indentation is | 3083 | ;; This lies within the children indent offset range, |
| 3106 | ;; less-or-equal than previous. And do not | 3084 | ;; so it's a normal child of its parent (i.e., not |
| 3107 | ;; discard the number of children, because the | 3085 | ;; a child of a child). |
| 3108 | ;; way code is scanned, all children are | 3086 | (cons (cons label pos) tree) |
| 3109 | ;; collected until a root node yet to be found | 3087 | ;; Oh no, a child of a child?! Fear not, we |
| 3110 | ;; appears. | 3088 | ;; know how to roll. We recursively parse these by |
| 3111 | (if (or (not prev-indent) | 3089 | ;; swapping prev-indent and min-indent plus adding this |
| 3112 | (and | 3090 | ;; newly found item to a fresh subtree. This works, I |
| 3113 | (> indent min-indent) | 3091 | ;; promise. |
| 3114 | (<= indent prev-indent))) | 3092 | (cons |
| 3115 | (1+ num-children) | 3093 | (python-imenu--build-tree |
| 3116 | num-children) | 3094 | prev-indent indent (list (cons label pos))) |
| 3117 | (cond ((not prev-indent) | 3095 | tree))))))) |
| 3118 | ;; First call to the function: append this | ||
| 3119 | ;; defun to the index. | ||
| 3120 | (list (cons label pos))) | ||
| 3121 | ((= indent prev-indent) | ||
| 3122 | ;; Add another defun with the same depth | ||
| 3123 | ;; as the previous. | ||
| 3124 | (cons (cons label pos) tree)) | ||
| 3125 | ((and (< indent prev-indent) | ||
| 3126 | (< 0 num-children)) | ||
| 3127 | ;; There are children to be appended and | ||
| 3128 | ;; the previous defun had more | ||
| 3129 | ;; indentation, the current one must be a | ||
| 3130 | ;; parent. | ||
| 3131 | (python-imenu--put-parent type name pos num-children tree)) | ||
| 3132 | ((> indent prev-indent) | ||
| 3133 | ;; There are children defuns deeper than | ||
| 3134 | ;; current depth. Fear not, we already | ||
| 3135 | ;; know how to treat them. | ||
| 3136 | (cons | ||
| 3137 | (prog1 | ||
| 3138 | (python-imenu--build-tree | ||
| 3139 | prev-indent indent 0 (list (cons label pos))) | ||
| 3140 | ;; Adjustment: after scanning backwards | ||
| 3141 | ;; for all deeper children, we need to | ||
| 3142 | ;; continue our scan for a parent from | ||
| 3143 | ;; the current defun we are looking at. | ||
| 3144 | (python-nav-forward-defun)) | ||
| 3145 | tree)))))))) | ||
| 3146 | 3096 | ||
| 3147 | (defun python-imenu-create-index () | 3097 | (defun python-imenu-create-index () |
| 3148 | "Return tree Imenu alist for the current python buffer. | 3098 | "Return tree Imenu alist for the current python buffer. |
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index ed911fcbba2..03364bddd9f 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el | |||
| @@ -3256,7 +3256,7 @@ inserted using a single call to `verilog-insert'." | |||
| 3256 | (defun verilog-point-text (&optional pointnum) | 3256 | (defun verilog-point-text (&optional pointnum) |
| 3257 | "Return text describing where POINTNUM or current point is (for errors). | 3257 | "Return text describing where POINTNUM or current point is (for errors). |
| 3258 | Use filename, if current buffer being edited shorten to just buffer name." | 3258 | Use filename, if current buffer being edited shorten to just buffer name." |
| 3259 | (concat (or (and (equal (window-buffer (selected-window)) (current-buffer)) | 3259 | (concat (or (and (equal (window-buffer) (current-buffer)) |
| 3260 | (buffer-name)) | 3260 | (buffer-name)) |
| 3261 | buffer-file-name | 3261 | buffer-file-name |
| 3262 | (buffer-name)) | 3262 | (buffer-name)) |