diff options
Diffstat (limited to 'lisp/progmodes')
79 files changed, 554 insertions, 470 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index c9a69005eaf..9581fd436b3 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el index 7cff0158f8a..10a5b670c54 100644 --- a/lisp/progmodes/ada-prj.el +++ b/lisp/progmodes/ada-prj.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ada-stmt.el b/lisp/progmodes/ada-stmt.el index a881753a0ab..483a54df13b 100644 --- a/lisp/progmodes/ada-stmt.el +++ b/lisp/progmodes/ada-stmt.el @@ -3,27 +3,12 @@ ;; Copyright (C) 1987, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, ;; 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +;; This file is part of GNU Emacs. + ;; Authors: Daniel Pfeiffer, Markus Heritsch, Rolf Ebert <ebert@waporo.muc.de> ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org> ;; Keywords: languages, ada -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - ;;; Commentary: ;; This file is now automatically loaded from ada-mode.el, and creates a submenu ;; in Ada/ on the menu bar. diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index e8db3d51c2a..9c239ee6dbb 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index 7fbeeab6eea..3b7a2015af5 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index d38e6170a23..3ca8c671e8c 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el index e01579917f6..1d08b094351 100644 --- a/lisp/progmodes/autoconf.el +++ b/lisp/progmodes/autoconf.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 40dd3b5831e..f9e44d784f1 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index 997e6c44f1a..b3e0e381135 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index 5a69df4e457..b2f793c0b1c 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 48fa7d99f5a..079ebb02622 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-compat.el b/lisp/progmodes/cc-compat.el index 81739f5adf1..07433b9630b 100644 --- a/lisp/progmodes/cc-compat.el +++ b/lisp/progmodes/cc-compat.el @@ -15,7 +15,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index e932456fa91..8c10df649de 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 44463a07f15..717016af7ea 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 60bb3cfb977..0df09eda481 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 9c749c11b6a..906cbfb19a7 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el index 95359689b9f..514945c269d 100644 --- a/lisp/progmodes/cc-menus.el +++ b/lisp/progmodes/cc-menus.el @@ -17,7 +17,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index f201f9bab6c..dcbcc618dca 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -17,7 +17,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index c5b9b063812..228269b67bf 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-subword.el b/lisp/progmodes/cc-subword.el index 68ecd3a0515..a6a365d316b 100644 --- a/lisp/progmodes/cc-subword.el +++ b/lisp/progmodes/cc-subword.el @@ -6,7 +6,7 @@ ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index a80833c0043..8d28cba79ad 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -18,7 +18,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index 06f464b29ce..756979b3d78 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el index 4722f0ca4ae..03fb90d992c 100644 --- a/lisp/progmodes/cmacexp.el +++ b/lisp/progmodes/cmacexp.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 13e4e40044b..a35bb6be2a2 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -38,11 +38,14 @@ ;; LINE will be nil for a message that doesn't contain them. Then the ;; location refers to a indented beginning of line or beginning of file. ;; Once any location in some file has been jumped to, the list is extended to -;; (COLUMN LINE FILE-STRUCTURE MARKER . VISITED) for all LOCs pertaining to -;; that file. +;; (COLUMN LINE FILE-STRUCTURE MARKER TIMESTAMP . VISITED) +;; for all LOCs pertaining to that file. ;; MARKER initially points to LINE and COLUMN in a buffer visiting that file. ;; Being a marker it sticks to some text, when the buffer grows or shrinks ;; before that point. VISITED is t if we have jumped there, else nil. +;; TIMESTAMP is necessary because of "incremental compilation": `omake -P' +;; polls filesystem for changes and recompiles when a file is modified +;; using the same *compilation* buffer. this necessitates re-parsing markers. ;; FILE-STRUCTURE is a list of ;; ((FILENAME . DIRECTORY) FORMATS (LINE LOC ...) ...) @@ -84,13 +87,13 @@ ;;;###autoload (defcustom compilation-mode-hook nil - "*List of hook functions run by `compilation-mode' (see `run-mode-hooks')." + "List of hook functions run by `compilation-mode' (see `run-mode-hooks')." :type 'hook :group 'compilation) ;;;###autoload (defcustom compilation-window-height nil - "*Number of lines in a compilation window. If nil, use Emacs default." + "Number of lines in a compilation window. If nil, use Emacs default." :type '(choice (const :tag "Default" nil) integer) :group 'compilation) @@ -164,6 +167,10 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) "^[ \t]*\\[[^] \n]+\\][ \t]*\\([^: \n]+\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):[0-9]+:[0-9]+:\\)?\ \\( warning\\)?" 1 2 3 (4)) + (maven + ;; Maven is a popular build tool for Java. Maven is Free Software. + "\\(.*?\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\]" 1 2 3) + (bash "^\\([^: \n\t]+\\): line \\([0-9]+\\):" 1 2) @@ -439,7 +446,7 @@ Highlight entire line if t; don't highlight source lines if nil.") "Overlay used to temporarily highlight compilation matches.") (defcustom compilation-error-screen-columns t - "*If non-nil, column numbers in error messages are screen columns. + "If non-nil, column numbers in error messages are screen columns. Otherwise they are interpreted as character positions, with each character occupying one column. The default is to use screen columns, which requires that the compilation @@ -450,21 +457,21 @@ especially the TAB character." :version "20.4") (defcustom compilation-read-command t - "*Non-nil means \\[compile] reads the compilation command to use. + "Non-nil means \\[compile] reads the compilation command to use. Otherwise, \\[compile] just uses the value of `compile-command'." :type 'boolean :group 'compilation) ;;;###autoload (defcustom compilation-ask-about-save t - "*Non-nil means \\[compile] asks which buffers to save before compiling. + "Non-nil means \\[compile] asks which buffers to save before compiling. Otherwise, it saves all modified buffers without asking." :type 'boolean :group 'compilation) ;;;###autoload (defcustom compilation-search-path '(nil) - "*List of directories to search for source files named in error messages. + "List of directories to search for source files named in error messages. Elements should be directory names, not file names of directories. The value nil as an element means to try the default directory." :type '(repeat (choice (const :tag "Default" nil) @@ -473,7 +480,7 @@ The value nil as an element means to try the default directory." ;;;###autoload (defcustom compile-command "make -k " - "*Last shell command used to do a compilation; default for next compilation. + "Last shell command used to do a compilation; default for next compilation. Sometimes it is useful for files to supply local values for this variable. You might also use mode hooks to specify it in certain modes, like this: @@ -491,7 +498,7 @@ You might also use mode hooks to specify it in certain modes, like this: ;;;###autoload (defcustom compilation-disable-input nil - "*If non-nil, send end-of-file as compilation process input. + "If non-nil, send end-of-file as compilation process input. This only affects platforms that support asynchronous processes (see `start-process'); synchronous compilation processes never accept input." :type 'boolean @@ -602,6 +609,16 @@ Faces `compilation-error-face', `compilation-warning-face', (defvar compilation-error-list nil) (defvar compilation-old-error-list nil) +(defcustom compilation-auto-jump-to-first-error nil + "If non-nil, automatically jump to the first error after `compile'." + :type 'boolean + :group 'compilation + :version "23.1") + +(defvar 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) + (defun compilation-face (type) (or (and (car type) (match-end (car type)) compilation-warning-face) (and (cdr type) (match-end (cdr type)) compilation-info-face) @@ -649,13 +666,18 @@ Faces `compilation-error-face', `compilation-warning-face', l2 (setcdr l1 (cons (list ,key) l2))))))) +(defun compilation-auto-jump (buffer pos) + (with-current-buffer buffer + (goto-char pos) + (compile-goto-error))) ;; This function is the central driver, called when font-locking to gather ;; all information needed to later jump to corresponding source code. ;; Return a property list with all meta information on this error location. (defun compilation-error-properties (file line end-line col end-col type fmt) - (unless (< (next-single-property-change (match-beginning 0) 'directory nil (point)) + (unless (< (next-single-property-change (match-beginning 0) + 'directory nil (point)) (point)) (if file (if (functionp file) @@ -707,6 +729,13 @@ Faces `compilation-error-face', `compilation-warning-face', (setq type (or (and (car type) (match-end (car type)) 1) (and (cdr type) (match-end (cdr type)) 0) 2))) + + (when (and compilation-auto-jump-to-next + (>= type compilation-skip-threshold)) + (kill-local-variable 'compilation-auto-jump-to-next) + (run-with-timer 0 nil 'compilation-auto-jump + (current-buffer) (match-beginning 0))) + (compilation-internal-error-properties file line end-line col end-col type fmt))) (defun compilation-move-to-column (col screen) @@ -911,7 +940,7 @@ to a function that generates a unique name." (unless (equal command (eval compile-command)) (setq compile-command command)) (save-some-buffers (not compilation-ask-about-save) nil) - (setq compilation-directory default-directory) + (setq-default compilation-directory default-directory) (compilation-start command comint)) ;; run compile with the default command line @@ -921,15 +950,12 @@ If this is run in a Compilation mode buffer, re-use the arguments from the original use. Otherwise, recompile using `compile-command'." (interactive) (save-some-buffers (not compilation-ask-about-save) nil) - (let ((default-directory - (or (and (not (eq major-mode (nth 1 compilation-arguments))) - compilation-directory) - default-directory))) + (let ((default-directory (or compilation-directory default-directory))) (apply 'compilation-start (or compilation-arguments `(,(eval compile-command)))))) (defcustom compilation-scroll-output nil - "*Non-nil to scroll the *compilation* buffer window as output appears. + "Non-nil to scroll the *compilation* buffer window as output appears. Setting it causes the Compilation mode commands to put point at the end of their output window so that the end of the output is always @@ -1019,12 +1045,17 @@ Returns the compilation buffer created." (buffer-disable-undo (current-buffer)) ;; first transfer directory from where M-x compile was called (setq default-directory thisdir) + ;; Remember the original dir, so we can use it when we recompile. + ;; default-directory' can't be used reliably for that because it may be + ;; affected by the special handling of "cd ...;". + (set (make-local-variable 'compilation-directory) thisdir) ;; Make compilation buffer read-only. The filter can still write it. ;; Clear out the compilation buffer. (let ((inhibit-read-only t) (default-directory thisdir)) - ;; Then evaluate a cd command if any, but don't perform it yet, else start-command - ;; would do it again through the shell: (cd "..") AND sh -c "cd ..; make" + ;; Then evaluate a cd command if any, but don't perform it yet, else + ;; start-command would do it again through the shell: (cd "..") AND + ;; sh -c "cd ..; make" (cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" command) (if (match-end 1) (substitute-env-vars (match-string 1 command)) @@ -1040,6 +1071,8 @@ Returns the compilation buffer created." (if highlight-regexp (set (make-local-variable 'compilation-highlight-regexp) highlight-regexp)) + (if compilation-auto-jump-to-first-error + (set (make-local-variable 'compilation-auto-jump-to-next) t)) ;; Output a mode setter, for saving and later reloading this buffer. (insert "-*- mode: " name-of-mode "; default-directory: " (prin1-to-string default-directory) @@ -1088,53 +1121,31 @@ Returns the compilation buffer created." (funcall compilation-process-setup-function)) (compilation-set-window-height outwin) ;; Start the compilation. - (if (fboundp 'start-process) - (let ((proc (if (eq mode t) - (get-buffer-process - (with-no-warnings - (comint-exec outbuf (downcase mode-name) - shell-file-name nil `("-c" ,command)))) - (start-process-shell-command (downcase mode-name) - outbuf command)))) - ;; Make the buffer's mode line show process state. - (setq mode-line-process '(":%s")) - (set-process-sentinel proc 'compilation-sentinel) - (set-process-filter proc 'compilation-filter) - (set-marker (process-mark proc) (point) outbuf) - (when compilation-disable-input - (condition-case nil - (process-send-eof proc) - ;; The process may have exited already. - (error nil))) - (setq compilation-in-progress - (cons proc compilation-in-progress))) - ;; No asynchronous processes available. - (message "Executing `%s'..." command) - ;; Fake modeline display as if `start-process' were run. - (setq mode-line-process ":run") - (force-mode-line-update) - (sit-for 0) ; Force redisplay - (let* ((buffer-read-only nil) ; call-process needs to modify outbuf - (status (call-process shell-file-name nil outbuf nil "-c" - command))) - (cond ((numberp status) - (compilation-handle-exit 'exit status - (if (zerop status) - "finished\n" - (format "\ -exited abnormally with code %d\n" - status)))) - ((stringp status) - (compilation-handle-exit 'signal status - (concat status "\n"))) - (t - (compilation-handle-exit 'bizarre status status)))) - ;; Without async subprocesses, the buffer is not yet - ;; fontified, so fontify it now. - (let ((font-lock-verbose nil)) ; shut up font-lock messages - (font-lock-fontify-buffer)) - (set-buffer-modified-p nil) - (message "Executing `%s'...done" command))) + (let ((proc + (if (eq mode t) + ;; comint uses `start-file-process'. + (get-buffer-process + (with-no-warnings + (comint-exec + outbuf (downcase mode-name) + (if (file-remote-p default-directory) + "/bin/sh" + shell-file-name) + `("-c" ,command)))) + (start-file-process-shell-command (downcase mode-name) + outbuf command)))) + ;; Make the buffer's mode line show process state. + (setq mode-line-process '(":%s")) + (set-process-sentinel proc 'compilation-sentinel) + (set-process-filter proc 'compilation-filter) + (set-marker (process-mark proc) (point) outbuf) + (when compilation-disable-input + (condition-case nil + (process-send-eof proc) + ;; The process may have exited already. + (error nil))) + (setq compilation-in-progress + (cons proc compilation-in-progress)))) ;; Now finally cd to where the shell started make/grep/... (setq default-directory thisdir)) (if (buffer-local-value 'compilation-scroll-output outbuf) @@ -1255,7 +1266,7 @@ exited abnormally with code %d\n" "*If non-nil, skip multiple error messages for the same source location.") (defcustom compilation-skip-threshold 1 - "*Compilation motion commands skip less important messages. + "Compilation motion commands skip less important messages. The value can be either 2 -- skip anything less than error, 1 -- skip anything less than warning or 0 -- don't skip any messages. Note that all messages not positively identified as warning or @@ -1267,7 +1278,7 @@ info, are considered errors." :version "22.1") (defcustom compilation-skip-visited nil - "*Compilation motion commands skip visited messages if this is t. + "Compilation motion commands skip visited messages if this is t. Visited messages are ones for which the file, line and column have been jumped to from the current content in the current compilation buffer, even if it was from a different message." @@ -1368,6 +1379,8 @@ Optional argument MINOR indicates this is called from ;; with the next-error function in simple.el, and it's only ;; coincidentally named similarly to compilation-next-error. (setq next-error-function 'compilation-next-error-function) + (set (make-local-variable 'comint-file-name-prefix) + (or (file-remote-p default-directory) "")) (set (make-local-variable 'font-lock-extra-managed-props) '(directory message help-echo mouse-face debug)) (set (make-local-variable 'compilation-locs) @@ -1516,7 +1529,7 @@ Just inserts the text, but uses `insert-before-markers'." (eq (prog1 last (setq last (nth 2 (car msg)))) last)) (if compilation-skip-visited - (nthcdr 4 (car msg))) + (nthcdr 5 (car msg))) (if compilation-skip-to-next-location (eq (car msg) loc)) ;; count this message only if none of the above are true @@ -1619,7 +1632,7 @@ This is the value of `next-error-function' in Compilation buffers." (when reset (setq compilation-current-error nil)) (let* ((columns compilation-error-screen-columns) ; buffer's local value - (last 1) + (last 1) timestamp (loc (compilation-next-error (or n 1) nil (or compilation-current-error compilation-messages-start @@ -1632,10 +1645,17 @@ This is the value of `next-error-function' in Compilation buffers." compilation-current-error (copy-marker (line-beginning-position))) loc (car loc)) - ;; If loc contains no marker, no error in that file has been visited. If - ;; the marker is invalid the buffer has been killed. So, recalculate all - ;; markers for that file. - (unless (and (nth 3 loc) (marker-buffer (nth 3 loc))) + ;; If loc contains no marker, no error in that file has been visited. + ;; If the marker is invalid the buffer has been killed. + ;; If the file is newer than the timestamp, it has been modified + ;; (`omake -P' polls filesystem for changes and recompiles when needed + ;; in the same process and buffer). + ;; So, recalculate all markers for that file. + (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)) + (equal (nth 4 loc) + (setq timestamp + (with-current-buffer (marker-buffer (nth 3 loc)) + (visited-file-modtime))))) (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) (cadr (car (nth 2 loc)))) (save-restriction @@ -1658,7 +1678,8 @@ This is the value of `next-error-function' in Compilation buffers." (set-marker (nth 3 col) (point)) (setcdr (nthcdr 2 col) `(,(point-marker))))))))) (compilation-goto-locus marker (nth 3 loc) (nth 3 end-loc)) - (setcdr (nthcdr 3 loc) t))) ; Set this one as visited. + (setcdr (nthcdr 3 loc) (list timestamp)) + (setcdr (nthcdr 4 loc) t))) ; Set this one as visited. (defvar compilation-gcpro nil "Internal variable used to keep some values from being GC'd.") @@ -1861,7 +1882,24 @@ Pop up the buffer containing MARKER and scroll to MARKER if we ask the user." (let* ((name (read-file-name (format "Find this %s in (default %s): " compilation-error filename) - spec-dir filename t nil)) + spec-dir filename t nil + ;; The predicate below is fine when called from + ;; minibuffer-complete-and-exit, but it's too + ;; restrictive otherwise, since it also prevents the + ;; user from completing "fo" to "foo/" when she + ;; wants to enter "foo/bar". + ;; + ;; 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)) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index d1dc0e875c4..a07fb5ee44f 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index e85c4752412..65ed00e6d6e 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el index 8ecf4119825..8f710bf20bc 100644 --- a/lisp/progmodes/cwarn.el +++ b/lisp/progmodes/cwarn.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el index 887416f9069..bdec1bf9ef4 100644 --- a/lisp/progmodes/dcl-mode.el +++ b/lisp/progmodes/dcl-mode.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el index 99f03f8a545..2402f48d7ea 100644 --- a/lisp/progmodes/delphi.el +++ b/lisp/progmodes/delphi.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free -;; Software Foundation; either version 3, or (at your option) any later +;; Software Foundation; either version 2, or (at your option) any later ;; version. ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY diff --git a/lisp/progmodes/ebnf-abn.el b/lisp/progmodes/ebnf-abn.el index 5e0d4b41820..48de29808b6 100644 --- a/lisp/progmodes/ebnf-abn.el +++ b/lisp/progmodes/ebnf-abn.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf-bnf.el b/lisp/progmodes/ebnf-bnf.el index 6ade2fdc900..443e2c23cd5 100644 --- a/lisp/progmodes/ebnf-bnf.el +++ b/lisp/progmodes/ebnf-bnf.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf-dtd.el b/lisp/progmodes/ebnf-dtd.el index 36fb314e642..f4c57ea2818 100644 --- a/lisp/progmodes/ebnf-dtd.el +++ b/lisp/progmodes/ebnf-dtd.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf-ebx.el b/lisp/progmodes/ebnf-ebx.el index cca85a10c2d..d506e9cc54d 100644 --- a/lisp/progmodes/ebnf-ebx.el +++ b/lisp/progmodes/ebnf-ebx.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf-iso.el b/lisp/progmodes/ebnf-iso.el index 802cf019d85..2e666328390 100644 --- a/lisp/progmodes/ebnf-iso.el +++ b/lisp/progmodes/ebnf-iso.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf-otz.el b/lisp/progmodes/ebnf-otz.el index c4f9fdcd8c1..bcf8032318c 100644 --- a/lisp/progmodes/ebnf-otz.el +++ b/lisp/progmodes/ebnf-otz.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el index 829494cd7ef..5defea14d50 100644 --- a/lisp/progmodes/ebnf-yac.el +++ b/lisp/progmodes/ebnf-yac.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el index 75fc250745e..55f61222796 100644 --- a/lisp/progmodes/ebnf2ps.el +++ b/lisp/progmodes/ebnf2ps.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el index 58a25ab5b88..5ccd6238208 100644 --- a/lisp/progmodes/ebrowse.el +++ b/lisp/progmodes/ebrowse.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 196c22b4a08..eecd4682fd1 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index 3f46b0bbbe3..932c1f32ec5 100644 --- a/lisp/progmodes/executable.el +++ b/lisp/progmodes/executable.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 6c704916c65..9ee4b515eed 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 0ce53f43937..7e353247b04 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -325,11 +325,6 @@ Return nil if we cannot, non-nil if we can." (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 'flymake-get-real-file-name)) -(defcustom flymake-buildfile-dirs '("." ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../.." "../../../../../../.." "../../../../../../../.." "../../../../../../../../.." "../../../../../../../../../.." "../../../../../../../../../../..") - "Dirs to look for buildfile." - :group 'flymake - :type '(repeat (string))) - (defvar flymake-find-buildfile-cache (flymake-makehash 'equal)) (defun flymake-get-buildfile-from-cache (dir-name) @@ -346,19 +341,15 @@ Return nil if we cannot, non-nil if we can." Buildfile includes Makefile, build.xml etc. Return its file name if found, or nil if not found." (or (flymake-get-buildfile-from-cache source-dir-name) - (let* ((dirs flymake-buildfile-dirs) - (buildfile-dir nil) - (found nil)) - (while (and (not found) dirs) - (setq buildfile-dir (concat source-dir-name (car dirs))) - (when (file-exists-p (expand-file-name buildfile-name buildfile-dir)) - (setq found t)) - (setq dirs (cdr dirs))) - (if found + (let* ((file (locate-dominating-file + source-dir-name + (concat "\\`" (regexp-quote buildfile-name) "\\'")))) + (if file (progn - (flymake-log 3 "found buildfile at %s/%s" buildfile-dir buildfile-name) - (flymake-add-buildfile-to-cache source-dir-name buildfile-dir) - buildfile-dir) + (flymake-log 3 "found buildfile at %s" file) + (setq file (file-name-directory file)) + (flymake-add-buildfile-to-cache source-dir-name file) + file) (progn (flymake-log 3 "buildfile for %s not found" source-dir-name) nil))))) diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index b9865613765..cb843b4ecd8 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el index 8f6be334465..7bc904f8319 100644 --- a/lisp/progmodes/gdb-ui.el +++ b/lisp/progmodes/gdb-ui.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/glasses.el b/lisp/progmodes/glasses.el index c2aa2dbb3ac..580d8d9e4bf 100644 --- a/lisp/progmodes/glasses.el +++ b/lisp/progmodes/glasses.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index baa59c764fd..fd93015ab2c 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -343,6 +343,12 @@ This variable's value takes effect when `grep-compute-defaults' is called.") (defvar grep-regexp-history nil) (defvar grep-files-history '("ch" "el")) +(defvar grep-host-defaults-alist nil + "Default values depending on target host. +`grep-compute-defaults' returns default values for every local or +remote host `grep' runs. These values can differ from host to +host. Once computed, the default values are kept here in order +to avoid computing them again.") ;;;###autoload (defun grep-process-setup () @@ -371,92 +377,153 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." (defun grep-probe (command args &optional func result) (equal (condition-case nil - (apply (or func 'call-process) command args) + (apply (or func 'process-file) command args) (error nil)) (or result 0))) ;;;###autoload (defun grep-compute-defaults () - (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) - (setq grep-use-null-device - (with-temp-buffer - (let ((hello-file (expand-file-name "HELLO" data-directory))) - (not - (and (if grep-command - ;; `grep-command' is already set, so - ;; use that for testing. - (grep-probe grep-command - `(nil t nil "^English" ,hello-file) - #'call-process-shell-command) - ;; otherwise use `grep-program' - (grep-probe grep-program - `(nil t nil "-nH" "^English" ,hello-file))) - (progn - (goto-char (point-min)) - (looking-at - (concat (regexp-quote hello-file) - ":[0-9]+:English"))))))))) - (unless (and grep-command grep-find-command - grep-template grep-find-template) - (let ((grep-options - (concat (if grep-use-null-device "-n" "-nH") - (if (grep-probe grep-program - `(nil nil nil "-e" "foo" ,null-device) - nil 1) - " -e")))) - (unless grep-command - (setq grep-command - (format "%s %s " grep-program grep-options))) - (unless grep-template - (setq grep-template - (format "%s <C> %s <R> <F>" grep-program grep-options))) - (unless grep-find-use-xargs - (setq grep-find-use-xargs - (cond - ((and - (grep-probe find-program `(nil nil nil ,null-device "-print0")) - (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo"))) - 'gnu) - (t - 'exec)))) - (unless grep-find-command - (setq grep-find-command - (cond ((eq grep-find-use-xargs 'gnu) - (format "%s . -type f -print0 | xargs -0 -e %s" - find-program grep-command)) - ((eq grep-find-use-xargs 'exec) - (let ((cmd0 (format "%s . -type f -exec %s" - find-program grep-command))) - (cons - (format "%s {} %s %s" - cmd0 null-device - (shell-quote-argument ";")) - (1+ (length cmd0))))) - (t - (format "%s . -type f -print | xargs %s" - find-program grep-command))))) - (unless grep-find-template - (setq grep-find-template - (let ((gcmd (format "%s <C> %s <R>" - grep-program grep-options))) + ;; Keep default values. + (unless grep-host-defaults-alist + (add-to-list + 'grep-host-defaults-alist + (cons nil + `((grep-command ,grep-command) + (grep-template ,grep-template) + (grep-use-null-device ,grep-use-null-device) + (grep-find-command ,grep-find-command) + (grep-find-template ,grep-find-template) + (grep-find-use-xargs ,grep-find-use-xargs) + (grep-highlight-matches ,grep-highlight-matches))))) + (let* ((host-id + (intern (or (file-remote-p default-directory 'host) "localhost"))) + (host-defaults (assq host-id grep-host-defaults-alist)) + (defaults (assq nil grep-host-defaults-alist))) + ;; There are different defaults on different hosts. They must be + ;; computed for every host once. + (setq grep-command + (or (cadr (assq 'grep-command host-defaults)) + (cadr (assq 'grep-command defaults))) + + grep-template + (or (cadr (assq 'grep-template host-defaults)) + (cadr (assq 'grep-template defaults))) + + grep-use-null-device + (or (cadr (assq 'grep-use-null-device host-defaults)) + (cadr (assq 'grep-use-null-device defaults))) + + grep-find-command + (or (cadr (assq 'grep-find-command host-defaults)) + (cadr (assq 'grep-find-command defaults))) + + grep-find-template + (or (cadr (assq 'grep-find-template host-defaults)) + (cadr (assq 'grep-find-template defaults))) + + grep-find-use-xargs + (or (cadr (assq 'grep-find-use-xargs host-defaults)) + (cadr (assq 'grep-find-use-xargs defaults))) + + grep-highlight-matches + (or (cadr (assq 'grep-highlight-matches host-defaults)) + (cadr (assq 'grep-highlight-matches defaults)))) + + (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) + (setq grep-use-null-device + (with-temp-buffer + (let ((hello-file (expand-file-name "HELLO" data-directory))) + (not + (and (if grep-command + ;; `grep-command' is already set, so + ;; use that for testing. + (grep-probe grep-command + `(nil t nil "^English" ,hello-file) + #'call-process-shell-command) + ;; otherwise use `grep-program' + (grep-probe grep-program + `(nil t nil "-nH" "^English" ,hello-file))) + (progn + (goto-char (point-min)) + (looking-at + (concat (regexp-quote hello-file) + ":[0-9]+:English"))))))))) + (unless (and grep-command grep-find-command + grep-template grep-find-template) + (let ((grep-options + (concat (if grep-use-null-device "-n" "-nH") + (if (grep-probe grep-program + `(nil nil nil "-e" "foo" ,null-device) + nil 1) + " -e")))) + (unless grep-command + (setq grep-command + (format "%s %s " grep-program grep-options))) + (unless grep-template + (setq grep-template + (format "%s <C> %s <R> <F>" grep-program grep-options))) + (unless grep-find-use-xargs + (setq grep-find-use-xargs + (cond + ((and + (grep-probe find-program `(nil nil nil ,null-device "-print0")) + (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo"))) + 'gnu) + (t + 'exec)))) + (unless grep-find-command + (setq grep-find-command (cond ((eq grep-find-use-xargs 'gnu) - (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s" - find-program gcmd)) + (format "%s . -type f -print0 | xargs -0 -e %s" + find-program grep-command)) ((eq grep-find-use-xargs 'exec) - (format "%s . <X> -type f <F> -exec %s {} %s %s" - find-program gcmd null-device - (shell-quote-argument ";"))) + (let ((cmd0 (format "%s . -type f -exec %s" + find-program grep-command))) + (cons + (format "%s {} %s %s" + cmd0 null-device + (shell-quote-argument ";")) + (1+ (length cmd0))))) (t - (format "%s . <X> -type f <F> -print | xargs %s" - find-program gcmd)))))))) - (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) - (setq grep-highlight-matches - (with-temp-buffer - (and (grep-probe grep-program '(nil t nil "--help")) - (progn - (goto-char (point-min)) - (search-forward "--color" nil t)) - t))))) + (format "%s . -type f -print | xargs %s" + find-program grep-command))))) + (unless grep-find-template + (setq grep-find-template + (let ((gcmd (format "%s <C> %s <R>" + grep-program grep-options))) + (cond ((eq grep-find-use-xargs 'gnu) + (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s" + find-program gcmd)) + ((eq grep-find-use-xargs 'exec) + (format "%s . <X> -type f <F> -exec %s {} %s %s" + find-program gcmd null-device + (shell-quote-argument ";"))) + (t + (format "%s . <X> -type f <F> -print | xargs %s" + find-program gcmd)))))))) + (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) + (setq grep-highlight-matches + (with-temp-buffer + (and (grep-probe grep-program '(nil t nil "--help")) + (progn + (goto-char (point-min)) + (search-forward "--color" nil t)) + t)))) + + ;; Save defaults for this host. + (setq grep-host-defaults-alist + (delete (assq host-id grep-host-defaults-alist) + grep-host-defaults-alist)) + (add-to-list + 'grep-host-defaults-alist + (cons host-id + `((grep-command ,grep-command) + (grep-template ,grep-template) + (grep-use-null-device ,grep-use-null-device) + (grep-find-command ,grep-find-command) + (grep-find-template ,grep-find-template) + (grep-find-use-xargs ,grep-find-use-xargs) + (grep-highlight-matches ,grep-highlight-matches)))))) (defun grep-tag-default () (or (and transient-mark-mode mark-active diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index ec5b901f691..97144fec83b 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -237,7 +237,7 @@ Used to grey out relevant toolbar icons.") ([menu-bar run] menu-item ,(propertize "run" 'face 'font-lock-doc-face) gud-run :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) - ([menu-bar go] menu-item + ([menu-bar go] menu-item ,(propertize " go " 'face 'font-lock-doc-face) gud-go :visible (and (not gud-running) (eq gud-minor-mode 'gdba))) @@ -292,6 +292,11 @@ Used to grey out relevant toolbar icons.") (defun gud-file-name (f) "Transform a relative file name to an absolute file name. Uses `gud-<MINOR-MODE>-directories' to find the source files." + ;; When `default-directory' is a remote file name, prepend its + ;; remote part to f, which is the local file name. Fortunately, + ;; `file-remote-p' returns exactly this remote file name part (or + ;; nil otherwise). + (setq f (concat (or (file-remote-p default-directory) "") f)) (if (file-exists-p f) (expand-file-name f) (let ((directories (gud-val 'directories)) (result nil)) @@ -2510,7 +2515,10 @@ comint mode, which see." (while (and w (not (eq (car w) t))) (setq w (cdr w))) (if w - (setcar w file))) + (setcar w + (if (file-remote-p default-directory) + (setq file (file-name-nondirectory file)) + file)))) (apply 'make-comint (concat "gud" filepart) program nil (if massage-args (funcall massage-args file args) args)) ;; Since comint clobbered the mode, we don't set it until now. @@ -3114,7 +3122,7 @@ class of the file (using s to separate nested class ids)." 'syntax-table (eval-when-compile (string-to-syntax "> b"))) ;; Make sure that rehighlighting the previous line won't erase our - ;; syntax-table property. + ;; syntax-table property. (put-text-property (1- (match-beginning 0)) (match-end 0) 'font-lock-multiline t) nil))))) diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index bb791b18c1b..8096dee59e2 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 3f2580a5d4b..7720b441700 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -508,8 +508,8 @@ Original match data is restored upon return." (defun hs-hide-comment-region (beg end &optional repos-end) "Hide a region from BEG to END, marking it as a comment. Optional arg REPOS-END means reposition at end." - (let ((beg-eol (progn (goto-char beg) (end-of-line) (point))) - (end-eol (progn (goto-char end) (end-of-line) (point)))) + (let ((beg-eol (progn (goto-char beg) (line-end-position))) + (end-eol (progn (goto-char end) (line-end-position)))) (hs-discard-overlays beg-eol end-eol) (hs-make-overlay beg-eol end-eol 'comment beg end)) (goto-char (if repos-end end beg))) @@ -536,8 +536,7 @@ and then further adjusted to be at the end of the line." 'identity) pure-p)) ;; whatever the adjustment, we move to eol - (end-of-line) - (point))) + (line-end-position))) (q ;; `q' is the point at the end of the block (progn (hs-forward-sexp mdata 1) @@ -705,7 +704,7 @@ and `case-fold-search' are both t." (if (and c-reg (nth 0 c-reg)) ;; point is inside a comment, and that comment is hidable (goto-char (nth 0 c-reg)) - (end-of-line) + (end-of-line) (when (and (not c-reg) (hs-find-block-beginning) (looking-at hs-block-start-regexp)) @@ -734,12 +733,12 @@ Move point to the beginning of the line, and run the normal hook If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." (interactive) (hs-life-goes-on - (message "Hiding all blocks ...") (save-excursion (unless hs-allow-nesting (hs-discard-overlays (point-min) (point-max))) (goto-char (point-min)) - (let ((count 0) + (let ((spew (make-progress-reporter "Hiding all blocks..." + (point-min) (point-max))) (re (concat "\\(" hs-block-start-regexp "\\)" @@ -765,9 +764,9 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1) (hs-hide-block-at-point t c-reg) (goto-char (nth 1 c-reg)))))) - (message "Hiding ... %d" (setq count (1+ count)))))) + (progress-reporter-update spew (point))) + (progress-reporter-done spew))) (beginning-of-line) - (message "Hiding all blocks ... done") (run-hooks 'hs-hide-hook))) (defun hs-show-all () @@ -806,7 +805,7 @@ See documentation for functions `hs-hide-block' and `run-hooks'." (hs-life-goes-on (or ;; first see if we have something at the end of the line - (let ((ov (hs-overlay-at (save-excursion (end-of-line) (point)))) + (let ((ov (hs-overlay-at (line-end-position))) (here (point))) (when ov (goto-char @@ -906,9 +905,9 @@ Key bindings: (progn (hs-grok-mode-type) ;; Turn off this mode if we change major modes. - (add-hook 'change-major-mode-hook - 'turn-off-hideshow - nil t) + (add-hook 'change-major-mode-hook + 'turn-off-hideshow + nil t) (easy-menu-add hs-minor-mode-menu) (set (make-local-variable 'line-move-ignore-invisible) t) (add-to-invisibility-spec '(hs . t))) diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el index 77a38f6016d..9c47cf96e2b 100644 --- a/lisp/progmodes/icon.el +++ b/lisp/progmodes/icon.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/idlw-complete-structtag.el b/lisp/progmodes/idlw-complete-structtag.el index d005c6de63e..030f4a9f0c4 100644 --- a/lisp/progmodes/idlw-complete-structtag.el +++ b/lisp/progmodes/idlw-complete-structtag.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el index e7f0fa1677a..030b785acdf 100644 --- a/lisp/progmodes/idlw-help.el +++ b/lisp/progmodes/idlw-help.el @@ -12,7 +12,7 @@ ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index f903d490565..3b9fb5a896a 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -14,7 +14,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el index 2d143a3ddaa..ddf08755544 100644 --- a/lisp/progmodes/idlw-toolbar.el +++ b/lisp/progmodes/idlw-toolbar.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 1e600d6c456..4c58919ec1f 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -14,7 +14,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index 57142c0c043..02d44e55019 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el index c69b7a13cb9..01f9ecbc7a3 100644 --- a/lisp/progmodes/ld-script.el +++ b/lisp/progmodes/ld-script.el @@ -10,7 +10,7 @@ ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/m4-mode.el b/lisp/progmodes/m4-mode.el index 831d0fd5bb9..bd31f731693 100644 --- a/lisp/progmodes/m4-mode.el +++ b/lisp/progmodes/m4-mode.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index d3caaf36fc9..6178e7e47cd 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/mantemp.el b/lisp/progmodes/mantemp.el index 63661eeb27d..2084f364d55 100644 --- a/lisp/progmodes/mantemp.el +++ b/lisp/progmodes/mantemp.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your +;; by the Free Software Foundation; either version 2, or (at your ;; option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, but diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el index a2fd9cdab04..8215befc1de 100644 --- a/lisp/progmodes/meta-mode.el +++ b/lisp/progmodes/meta-mode.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el index 60dcdc625a8..146b228453e 100644 --- a/lisp/progmodes/mixal-mode.el +++ b/lisp/progmodes/mixal-mode.el @@ -3,29 +3,27 @@ ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 ;; Free Software Foundation, Inc. +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of +;; the License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be +;; useful, but WITHOUT ANY WARRANTY; without even the implied +;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +;; PURPOSE. See the GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public +;; License along with this program; if not, write to the Free +;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA + ;; Author: Pieter E.J. Pareit <pieter.pareit@gmail.com> ;; Maintainer: Pieter E.J. Pareit <pieter.pareit@gmail.com> ;; Created: 09 Nov 2002 ;; Version: 0.1 ;; Keywords: Knuth mix mixal asm mixvm "The Art Of Computer Programming" -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - ;;; Commentary: ;; Major mode for the mix asm language. ;; The mix asm language is described in "The Art Of Computer Programming". diff --git a/lisp/progmodes/octave-hlp.el b/lisp/progmodes/octave-hlp.el index 744d4cf13bf..5c2bd2f34ee 100644 --- a/lisp/progmodes/octave-hlp.el +++ b/lisp/progmodes/octave-hlp.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/octave-inf.el b/lisp/progmodes/octave-inf.el index 83d99ab8bee..b46510b5ac9 100644 --- a/lisp/progmodes/octave-inf.el +++ b/lisp/progmodes/octave-inf.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el index adc1b44edaa..be56d388330 100644 --- a/lisp/progmodes/octave-mod.el +++ b/lisp/progmodes/octave-mod.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el index 02fdbbbf050..3fe57e00c7a 100644 --- a/lisp/progmodes/pascal.el +++ b/lisp/progmodes/pascal.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index cfef0eedfe4..75920a43aa7 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -15,7 +15,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 7cff1bc516e..cb451791dbe 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el index 40eca7c1bd1..db4cd2dd339 100644 --- a/lisp/progmodes/ps-mode.el +++ b/lisp/progmodes/ps-mode.el @@ -13,7 +13,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1a84d461dba..26fc122631d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -883,10 +883,13 @@ On a comment line, go to end of line." nil) ((eq 'string (syntax-ppss-context s)) ;; Go to start of string and skip it. - (goto-char (nth 8 s)) - (condition-case () ; beware invalid syntax - (progn (forward-sexp) t) - (error (end-of-line)))) + (let ((pos (point))) + (goto-char (nth 8 s)) + (condition-case () ; beware invalid syntax + (progn (forward-sexp) t) + ;; If there's a mismatched string, make sure + ;; we still overall move *forward*. + (error (goto-char pos) (end-of-line))))) ((python-skip-out t s)))) (end-of-line)) (unless comment @@ -981,15 +984,11 @@ don't move and return nil. Otherwise return t." (_ (if (python-comment-line-p) (python-skip-comments/blanks t))) (ci (current-indentation)) - (open (python-open-block-statement-p)) - opoint) + (open (python-open-block-statement-p))) (if (and (zerop ci) (not open)) (not (goto-char point)) (catch 'done - (setq opoint (point)) - (while (and (zerop (python-next-statement)) - (not (= opoint (point)))) - (setq opoint (point)) + (while (zerop (python-next-statement)) (when (or (and open (<= (current-indentation) ci)) (< (current-indentation) ci)) (python-skip-comments/blanks t) @@ -997,7 +996,16 @@ don't move and return nil. Otherwise return t." (throw 'done t))))))) (setq arg (1- arg))) (zerop arg))) - + +(defvar python-which-func-length-limit 40 + "Non-strict length limit for `python-which-func' output.") + +(defun python-which-func () + (let ((function-name (python-current-defun python-which-func-length-limit))) + (set-text-properties 0 (length function-name) nil function-name) + function-name)) + + ;;;; Imenu. (defvar python-recursing) @@ -1815,22 +1823,30 @@ of current line." (1+ (/ (current-indentation) python-indent))) ;; Fixme: Consider top-level assignments, imports, &c. -(defun python-current-defun () +(defun python-current-defun (&optional length-limit) "`add-log-current-defun-function' for Python." (save-excursion ;; Move up the tree of nested `class' and `def' blocks until we ;; get to zero indentation, accumulating the defined names. (let ((start t) - accum) - (while (or start (> (current-indentation) 0)) + (accum) + (length -1)) + (while (and (or start (> (current-indentation) 0)) + (or (null length-limit) + (null (cdr accum)) + (< length length-limit))) (setq start nil) (python-beginning-of-block) (end-of-line) (beginning-of-defun) - (if (looking-at (rx (0+ space) (or "def" "class") (1+ space) - (group (1+ (or word (syntax symbol)))))) - (push (match-string 1) accum))) - (if accum (mapconcat 'identity accum "."))))) + (when (looking-at (rx (0+ space) (or "def" "class") (1+ space) + (group (1+ (or word (syntax symbol)))))) + (push (match-string 1) accum) + (setq length (+ length 1 (length (car accum)))))) + (when accum + (when (and length-limit (> length length-limit)) + (setcar accum "..")) + (mapconcat 'identity accum "."))))) (defun python-mark-block () "Mark the block around point. @@ -1926,7 +1942,7 @@ Repeating the command scrolls the completion window." (interactive) (let ((window (get-buffer-window "*Completions*"))) (if (and (eq last-command this-command) - window (window-live-p window) (window-buffer window) + (window-live-p window) (window-buffer window) (buffer-name (window-buffer window))) (with-current-buffer (window-buffer window) (if (pos-visible-in-window-p (point-max) window) @@ -2249,6 +2265,7 @@ with skeleton expansions for compound statement templates. (set (make-local-variable 'beginning-of-defun-function) 'python-beginning-of-defun) (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun) + (add-hook 'which-func-functions 'python-which-func nil t) (setq imenu-create-index-function #'python-imenu-create-index) (set (make-local-variable 'eldoc-documentation-function) #'python-eldoc-function) diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index 5bf7cb1e9eb..a112cee62bb 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 959c1685a74..8a8d23db169 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -241,7 +241,7 @@ (wsh . sh) (zsh . ksh88) (rpm . sh)) - "*Alist showing the direct ancestor of various shells. + "Alist showing the direct ancestor of various shells. This is the basis for `sh-feature'. See also `sh-alias-alist'. By default we have the following three hierarchies: @@ -276,7 +276,7 @@ sh Bourne Shell '((ksh . ksh88) (bash2 . bash) (sh5 . sh))) - "*Alist for transforming shell names to what they really are. + "Alist for transforming shell names to what they really are. Use this where the name of the executable doesn't correspond to the type of shell it really is." :type '(repeat (cons symbol symbol)) @@ -302,7 +302,7 @@ shell it really is." (file-name-sans-extension (downcase shell))))) (getenv "SHELL") "/bin/sh") - "*The executable file name for the shell being programmed." + "The executable file name for the shell being programmed." :type 'string :group 'sh-script) @@ -321,7 +321,7 @@ shell it really is." (wksh) ;; -f means don't run .zshrc. (zsh . "-f")) - "*Single argument string for the magic number. See `sh-feature'." + "Single argument string for the magic number. See `sh-feature'." :type '(repeat (cons (symbol :tag "Shell") (choice (const :tag "No Arguments" nil) (string :tag "Arguments") @@ -330,8 +330,8 @@ shell it really is." (defcustom sh-imenu-generic-expression `((sh - . ((nil "^\\s-*\\(function\\s-+\\)?\\([A-Za-z_][A-Za-z_0-9]+\\)\\s-*()" 2)))) - "*Alist of regular expressions for recognizing shell function definitions. + . ((nil "^\\s-*\\(function\\s-+\\)?\\([[:alpha:]_][[:alnum:]_]+\\)\\s-*()" 2)))) + "Alist of regular expressions for recognizing shell function definitions. See `sh-feature' and `imenu-generic-expression'." :type '(alist :key-type (symbol :tag "Shell") :value-type (alist :key-type (choice :tag "Title" @@ -507,7 +507,7 @@ This is buffer-local in every such buffer.") '(shell-dynamic-complete-environment-variable shell-dynamic-complete-command comint-dynamic-complete-filename) - "*Functions for doing TAB dynamic completion." + "Functions for doing TAB dynamic completion." :type '(repeat function) :group 'sh-script) @@ -515,7 +515,7 @@ This is buffer-local in every such buffer.") (defcustom sh-require-final-newline '((csh . t) (pdksh . t)) - "*Value of `require-final-newline' in Shell-Script mode buffers. + "Value of `require-final-newline' in Shell-Script mode buffers. \(SHELL . t) means use the value of `mode-require-final-newline' for SHELL. See `sh-feature'." :type '(repeat (cons (symbol :tag "Shell") @@ -525,12 +525,12 @@ See `sh-feature'." (defcustom sh-assignment-regexp - '((csh . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") + '((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=") ;; actually spaces are only supported in let/(( ... )) - (ksh88 . "\\<\\([a-zA-Z0-9_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=") - (rc . "\\<\\([a-zA-Z0-9_*]+\\)[ \t]*=") - (sh . "\\<\\([a-zA-Z0-9_]+\\)=")) - "*Regexp for the variable name and what may follow in an assignment. + (ksh88 . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=") + (rc . "\\<\\([[:alnum:]_*]+\\)[ \t]*=") + (sh . "\\<\\([[:alnum:]_]+\\)=")) + "Regexp for the variable name and what may follow in an assignment. First grouping matches the variable name. This is upto and including the `=' sign. See `sh-feature'." :type '(repeat (cons (symbol :tag "Shell") @@ -546,7 +546,7 @@ sign. See `sh-feature'." (defcustom sh-remember-variable-min 3 - "*Don't remember variables less than this length for completing reads." + "Don't remember variables less than this length for completing reads." :type 'integer :group 'sh-script) @@ -557,16 +557,16 @@ That command is also used for setting this variable.") (defcustom sh-beginning-of-command - "\\([;({`|&]\\|\\`\\|[^\\]\n\\)[ \t]*\\([/~a-zA-Z0-9:]\\)" - "*Regexp to determine the beginning of a shell command. + "\\([;({`|&]\\|\\`\\|[^\\]\n\\)[ \t]*\\([/~[:alnum:]:]\\)" + "Regexp to determine the beginning of a shell command. The actual command starts at the beginning of the second \\(grouping\\)." :type 'regexp :group 'sh-script) (defcustom sh-end-of-command - "\\([/~a-zA-Z0-9:]\\)[ \t]*\\([;#)}`|&]\\|$\\)" - "*Regexp to determine the end of a shell command. + "\\([/~[:alnum:]:]\\)[ \t]*\\([;#)}`|&]\\|$\\)" + "Regexp to determine the end of a shell command. The actual command ends at the end of the first \\(grouping\\)." :type 'regexp :group 'sh-script) @@ -653,6 +653,7 @@ removed when closing the here document." (shell "cd" "echo" "eval" "set" "shift" "umask" "unset" "wait") (wksh sh-append ksh88 + ;; FIXME: This looks too much like a regexp. --Stef "Xt[A-Z][A-Za-z]*") (zsh sh-append ksh88 @@ -662,7 +663,7 @@ removed when closing the here document." "readonly" "rehash" "sched" "setopt" "source" "suspend" "true" "ttyctl" "type" "unfunction" "unhash" "unlimit" "unsetopt" "vared" "which")) - "*List of all shell builtins for completing read and fontification. + "List of all shell builtins for completing read and fontification. Note that on some systems not all builtins are available or some are implemented as aliases. See `sh-feature'." :type '(repeat (cons (symbol :tag "Shell") @@ -683,7 +684,7 @@ implemented as aliases. See `sh-feature'." (rc "else") (sh "!" "do" "elif" "else" "if" "then" "trap" "type" "until" "while")) - "*List of keywords that may be immediately followed by a builtin or keyword. + "List of keywords that may be immediately followed by a builtin or keyword. Given some confusion between keywords and builtins depending on shell and system, the distinction here has been based on whether they influence the flow of control or syntax. See `sh-feature'." @@ -722,7 +723,7 @@ flow of control or syntax. See `sh-feature'." (zsh sh-append bash "select")) - "*List of keywords not in `sh-leading-keywords'. + "List of keywords not in `sh-leading-keywords'. See `sh-feature'." :type '(repeat (cons (symbol :tag "Shell") (choice (repeat string) @@ -843,18 +844,18 @@ See `sh-feature'.") (defvar sh-font-lock-keywords-var '((csh sh-append shell - ("\\${?[#?]?\\([A-Za-z_][A-Za-z0-9_]*\\|0\\)" 1 + ("\\${?[#?]?\\([[:alpha:]_][[:alnum:]_]*\\|0\\)" 1 font-lock-variable-name-face)) (es sh-append executable-font-lock-keywords - ("\\$#?\\([A-Za-z_][A-Za-z0-9_]*\\|[0-9]+\\)" 1 + ("\\$#?\\([[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\)" 1 font-lock-variable-name-face)) (rc sh-append es) (bash sh-append shell ("\\$(\\(\\sw+\\)" (1 'sh-quoted-exec t) )) (sh sh-append shell ;; Variable names. - ("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2 + ("\\$\\({#?\\)?\\([[:alpha:]_][[:alnum:]_]*\\|[-#?@!]\\)" 2 font-lock-variable-name-face) ;; Function names. ("^\\(\\sw+\\)[ \t]*(" 1 font-lock-function-name-face) @@ -867,8 +868,8 @@ See `sh-feature'.") (shell ;; Using font-lock-string-face here confuses sh-get-indent-info. ("\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\\\)$" 3 'sh-escaped-newline) - ("\\\\[^A-Za-z0-9]" 0 font-lock-string-face) - ("\\${?\\([A-Za-z_][A-Za-z0-9_]*\\|[0-9]+\\|[$*_]\\)" 1 + ("\\\\[^[:alnum:]]" 0 font-lock-string-face) + ("\\${?\\([[:alpha:]_][[:alnum:]_]*\\|[0-9]+\\|[$*_]\\)" 1 font-lock-variable-name-face)) (rpm sh-append rpm2 ("%{?\\(\\sw+\\)" 1 font-lock-keyword-face)) @@ -985,7 +986,7 @@ Point is at the beginning of the next line." ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. (re-search-forward sh-here-doc-re limit t)) -(defun sh-quoted-subshell (limit) +(defun sh-font-lock-quoted-subshell (limit) "Search for a subshell embedded in a string. Find all the unescaped \" characters within said subshell, remembering that subshells can nest." @@ -997,46 +998,39 @@ subshells can nest." (eq ?\" (nth 3 (syntax-ppss)))) ;; 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) )) + ;; `state' can be: double-quote, backquote, code. + (state (if (eq (char-before) ?`) 'backquote 'code)) + ;; Stacked states in the context. + (states '(double-quote))) + (while (and state (progn (skip-chars-forward "^'\\\"`$()" limit) + (< (point) limit))) + ;; unescape " inside a $( ... ) construct. + (case (char-after) + (?\' (skip-chars-forward "^'" limit)) + (?\\ (forward-char 1)) + (?\" (case state + (double-quote (setq state (pop states))) + (t (push state states) (setq state 'double-quote))) + (if state (put-text-property (point) (1+ (point)) + 'syntax-table '(1)))) + (?\` (case state + (backquote (setq state (pop states))) + (t (push state states) (setq state 'backquote)))) + (?\$ (if (not (eq (char-after (1+ (point))) ?\()) + nil + (forward-char 1) + (case state + (t (push state states) (setq state 'code))))) + (?\( (case state + (double-quote nil) + (t (push state states) (setq state 'code)))) + (?\) (case state + (double-quote nil) + (t (setq state (pop states))))) + (t (error "Internal error in sh-font-lock-quoted-subshell"))) + (forward-char 1))) + t)) + (defun sh-is-quoted-p (pos) (and (eq (char-before pos) ?\\) @@ -1092,17 +1086,6 @@ subshells can nest." (goto-char limit) nil) -(defun sh-apply-quoted-subshell () - "Apply the `sh-st-punc' syntax to all the matches in `match-data'. -This is used to flag quote characters in subshell constructs inside strings -\(which should therefore not be treated as normal quote characters\)" - (let ((m (match-data)) a b) - (while m - (setq a (car m) - b (cadr m) - m (cddr m)) - (put-text-property a b 'syntax-table sh-st-punc))) sh-st-punc) - (defconst sh-font-lock-syntactic-keywords ;; A `#' begins a comment when it is unquoted and at the beginning of a ;; word. In the shell, words are separated by metacharacters. @@ -1129,8 +1112,7 @@ This is used to flag quote characters in subshell constructs inside strings (")" 0 (sh-font-lock-paren (match-beginning 0))) ;; highlight (possibly nested) subshells inside "" quoted regions correctly. ;; This should be at the very end because it uses syntax-ppss. - (sh-quoted-subshell - (1 (sh-apply-quoted-subshell) t t)))) + (sh-font-lock-quoted-subshell))) (defun sh-font-lock-syntactic-face-function (state) (let ((q (nth 3 state))) @@ -1151,17 +1133,17 @@ and command `sh-reset-indent-vars-to-global-values'." (defcustom sh-set-shell-hook nil - "*Hook run by `sh-set-shell'." + "Hook run by `sh-set-shell'." :type 'hook :group 'sh-script) (defcustom sh-mode-hook nil - "*Hook run by `sh-mode'." + "Hook run by `sh-mode'." :type 'hook :group 'sh-script) (defcustom sh-learn-basic-offset nil - "*When `sh-guess-basic-offset' should learn `sh-basic-offset'. + "When `sh-guess-basic-offset' should learn `sh-basic-offset'. nil mean: never. t means: only if there seems to be an obvious value. @@ -1173,7 +1155,7 @@ Anything else means: whenever we have a \"good guess\" as to the value." :group 'sh-indentation) (defcustom sh-popup-occur-buffer nil - "*Controls when `sh-learn-buffer-indent' pops the `*indent*' buffer. + "Controls when `sh-learn-buffer-indent' pops the `*indent*' buffer. If t it is always shown. If nil, it is shown only when there are conflicts." :type '(choice @@ -1182,7 +1164,7 @@ are conflicts." :group 'sh-indentation) (defcustom sh-blink t - "*If non-nil, `sh-show-indent' shows the line indentation is relative to. + "If non-nil, `sh-show-indent' shows the line indentation is relative to. The position on the line is not necessarily meaningful. In some cases the line will be the matching keyword, but this is not always the case." @@ -1190,7 +1172,7 @@ always the case." :group 'sh-indentation) (defcustom sh-first-lines-indent 0 - "*The indentation of the first non-blank non-comment line. + "The indentation of the first non-blank non-comment line. Usually 0 meaning first column. Can be set to a number, or to nil which means leave it as is." :type '(choice @@ -1201,13 +1183,13 @@ Can be set to a number, or to nil which means leave it as is." (defcustom sh-basic-offset 4 - "*The default indentation increment. + "The default indentation increment. This value is used for the `+' and `-' symbols in an indentation variable." :type 'integer :group 'sh-indentation) (defcustom sh-indent-comment nil - "*How a comment line is to be indented. + "How a comment line is to be indented. nil means leave it as it is; t means indent it as a normal line, aligning it to previous non-blank non-comment line; @@ -1246,7 +1228,7 @@ a number means align to that column, e.g. 0 means fist column." :menu-tag "/ Indent left half sh-basic-offset"))) (defcustom sh-indent-for-else 0 - "*How much to indent an `else' relative to its `if'. Usually 0." + "How much to indent an `else' relative to its `if'. Usually 0." :type `(choice (integer :menu-tag "A number (positive=>indent right)" :tag "A number") @@ -1262,41 +1244,41 @@ a number means align to that column, e.g. 0 means fist column." sh-symbol-list)) (defcustom sh-indent-for-fi 0 - "*How much to indent a `fi' relative to its `if'. Usually 0." + "How much to indent a `fi' relative to its `if'. Usually 0." :type `(choice ,@ sh-number-or-symbol-list ) :group 'sh-indentation) (defcustom sh-indent-for-done 0 - "*How much to indent a `done' relative to its matching stmt. Usually 0." + "How much to indent a `done' relative to its matching stmt. Usually 0." :type `(choice ,@ sh-number-or-symbol-list ) :group 'sh-indentation) (defcustom sh-indent-after-else '+ - "*How much to indent a statement after an `else' statement." + "How much to indent a statement after an `else' statement." :type `(choice ,@ sh-number-or-symbol-list ) :group 'sh-indentation) (defcustom sh-indent-after-if '+ - "*How much to indent a statement after an `if' statement. + "How much to indent a statement after an `if' statement. This includes lines after `else' and `elif' statements, too, but does not affect the `else', `elif' or `fi' statements themselves." :type `(choice ,@ sh-number-or-symbol-list ) :group 'sh-indentation) (defcustom sh-indent-for-then 0 - "*How much to indent a `then' relative to its `if'." + "How much to indent a `then' relative to its `if'." :type `(choice ,@ sh-number-or-symbol-list ) :group 'sh-indentation) (defcustom sh-indent-for-do 0 - "*How much to indent a `do' statement. + "How much to indent a `do' statement. This is relative to the statement before the `do', typically a `while', `until', `for', `repeat' or `select' statement." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-indent-after-do '+ - "*How much to indent a line after a `do' statement. + "How much to indent a line after a `do' statement. This is used when the `do' is the first word of the line. This is relative to the statement before the `do', typically a `while', `until', `for', `repeat' or `select' statement." @@ -1304,7 +1286,7 @@ This is relative to the statement before the `do', typically a :group 'sh-indentation) (defcustom sh-indent-after-loop-construct '+ - "*How much to indent a statement after a loop construct. + "How much to indent a statement after a loop construct. This variable is used when the keyword `do' is on the same line as the loop statement (e.g., `until', `while' or `for'). @@ -1314,7 +1296,7 @@ If the `do' is on a line by itself, then `sh-indent-after-do' is used instead." (defcustom sh-indent-after-done 0 - "*How much to indent a statement after a `done' keyword. + "How much to indent a statement after a `done' keyword. Normally this is 0, which aligns the `done' to the matching looping construct line. Setting it non-zero allows you to have the `do' statement on a line @@ -1323,55 +1305,55 @@ by itself and align the done under to do." :group 'sh-indentation) (defcustom sh-indent-for-case-label '+ - "*How much to indent a case label statement. + "How much to indent a case label statement. This is relative to the line containing the `case' statement." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-indent-for-case-alt '++ - "*How much to indent statements after the case label. + "How much to indent statements after the case label. This is relative to the line containing the `case' statement." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-indent-for-continuation '+ - "*How much to indent for a continuation statement." + "How much to indent for a continuation statement." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-indent-after-open '+ - "*How much to indent after a line with an opening parenthesis or brace. + "How much to indent after a line with an opening parenthesis or brace. For an open paren after a function, `sh-indent-after-function' is used." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-indent-after-function '+ - "*How much to indent after a function line." + "How much to indent after a function line." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) ;; These 2 are for the rc shell: (defcustom sh-indent-after-switch '+ - "*How much to indent a `case' statement relative to the `switch' statement. + "How much to indent a `case' statement relative to the `switch' statement. This is for the rc shell." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-indent-after-case '+ - "*How much to indent a statement relative to the `case' statement. + "How much to indent a statement relative to the `case' statement. This is for the rc shell." :type `(choice ,@ sh-number-or-symbol-list) :group 'sh-indentation) (defcustom sh-backslash-column 48 - "*Column in which `sh-backslash-region' inserts backslashes." + "Column in which `sh-backslash-region' inserts backslashes." :type 'integer :group 'sh) (defcustom sh-backslash-align t - "*If non-nil, `sh-backslash-region' will align backslashes." + "If non-nil, `sh-backslash-region' will align backslashes." :type 'boolean :group 'sh) @@ -1381,7 +1363,7 @@ This is for the rc shell." "Make a regexp which matches WORD as a word. This specifically excludes an occurrence of WORD followed by punctuation characters like '-'." - (concat word "\\([^-a-z0-9_]\\|$\\)")) + (concat word "\\([^-[:alnum:]_]\\|$\\)")) (defconst sh-re-done (sh-mkword-regexpr "done")) @@ -2268,6 +2250,7 @@ STRING This is ignored for the purposes of calculating (setq align-point (point)))) (or (bobp) (forward-char -1)) + ;; FIXME: This charset looks too much like a regexp. --Stef (skip-chars-forward "[a-z0-9]*?") ) ((string-match "[])}]" x) @@ -2476,7 +2459,7 @@ we go to the end of the previous line and do not check for continuations." (if (looking-at "[\"'`]") (sh-safe-forward-sexp) ;; (> (skip-chars-forward "^ \t\n\"'`") 0) - (> (skip-chars-forward "-_a-zA-Z$0-9") 0) + (> (skip-chars-forward "-_$[:alnum:]") 0) )) (buffer-substring start (point)) )) diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el index db5d6552c84..89074dc8fe0 100644 --- a/lisp/progmodes/simula.el +++ b/lisp/progmodes/simula.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 1187129bb33..a3401dccbcb 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -14,7 +14,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index c7576a27114..0495b683bad 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -12,7 +12,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el index 6479fa3702b..c70ec7eab6c 100644 --- a/lisp/progmodes/vera-mode.el +++ b/lisp/progmodes/vera-mode.el @@ -19,7 +19,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -48,7 +48,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Documentation -;; See comment string of function `vera-mode' or type `C-c C-h' in Emacs. +;; See comment string of function `vera-mode' or type `C-h m' in Emacs. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Installation @@ -122,37 +122,37 @@ If nil, TAB always indents current line." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Key bindings -(defvar vera-mode-map () +(defvar vera-mode-map + (let ((map (make-sparse-keymap))) + ;; Backspace/delete key bindings. + (define-key map [backspace] 'backward-delete-char-untabify) + (unless (boundp 'delete-key-deletes-forward) ; XEmacs variable + (define-key map [delete] 'delete-char) + (define-key map [(meta delete)] 'kill-word)) + ;; Standard key bindings. + (define-key map "\M-e" 'vera-forward-statement) + (define-key map "\M-a" 'vera-backward-statement) + (define-key map "\M-\C-e" 'vera-forward-same-indent) + (define-key map "\M-\C-a" 'vera-backward-same-indent) + ;; Mode specific key bindings. + (define-key map "\C-c\t" 'indent-according-to-mode) + (define-key map "\M-\C-\\" 'vera-indent-region) + (define-key map "\C-c\C-c" 'vera-comment-uncomment-region) + (define-key map "\C-c\C-f" 'vera-fontify-buffer) + (define-key map "\C-c\C-v" 'vera-version) + (define-key map "\M-\t" 'tab-to-tab-stop) + ;; Electric key bindings. + (define-key map "\t" 'vera-electric-tab) + (define-key map "\r" 'vera-electric-return) + (define-key map " " 'vera-electric-space) + (define-key map "{" 'vera-electric-opening-brace) + (define-key map "}" 'vera-electric-closing-brace) + (define-key map "#" 'vera-electric-pound) + (define-key map "*" 'vera-electric-star) + (define-key map "/" 'vera-electric-slash) + map) "Keymap for Vera Mode.") -(setq vera-mode-map (make-sparse-keymap)) -;; backspace/delete key bindings -(define-key vera-mode-map [backspace] 'backward-delete-char-untabify) -(unless (boundp 'delete-key-deletes-forward) ; XEmacs variable - (define-key vera-mode-map [delete] 'delete-char) - (define-key vera-mode-map [(meta delete)] 'kill-word)) -;; standard key bindings -(define-key vera-mode-map "\M-e" 'vera-forward-statement) -(define-key vera-mode-map "\M-a" 'vera-backward-statement) -(define-key vera-mode-map "\M-\C-e" 'vera-forward-same-indent) -(define-key vera-mode-map "\M-\C-a" 'vera-backward-same-indent) -;; mode specific key bindings -(define-key vera-mode-map "\C-c\t" 'indent-according-to-mode) -(define-key vera-mode-map "\M-\C-\\" 'vera-indent-region) -(define-key vera-mode-map "\C-c\C-c" 'vera-comment-uncomment-region) -(define-key vera-mode-map "\C-c\C-f" 'vera-fontify-buffer) -(define-key vera-mode-map "\C-c\C-v" 'vera-version) -(define-key vera-mode-map "\M-\t" 'tab-to-tab-stop) -;; electric key bindings -(define-key vera-mode-map "\t" 'vera-electric-tab) -(define-key vera-mode-map "\r" 'vera-electric-return) -(define-key vera-mode-map " " 'vera-electric-space) -(define-key vera-mode-map "{" 'vera-electric-opening-brace) -(define-key vera-mode-map "}" 'vera-electric-closing-brace) -(define-key vera-mode-map "#" 'vera-electric-pound) -(define-key vera-mode-map "*" 'vera-electric-star) -(define-key vera-mode-map "/" 'vera-electric-slash) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Menu @@ -844,21 +844,19 @@ This function does not modify point or mark." (defsubst vera-re-search-forward (regexp &optional bound noerror) "Like `re-search-forward', but skips over matches in literals." - (store-match-data '(nil nil)) - (while (and (re-search-forward regexp bound noerror) - (vera-skip-forward-literal) - (progn (store-match-data '(nil nil)) - (if bound (< (point) bound) t)))) - (match-end 0)) + (let (ret) + (while (and (setq ret (re-search-forward regexp bound noerror)) + (vera-skip-forward-literal) + (if bound (< (point) bound) t))) + ret)) (defsubst vera-re-search-backward (regexp &optional bound noerror) "Like `re-search-backward', but skips over matches in literals." - (store-match-data '(nil nil)) - (while (and (re-search-backward regexp bound noerror) - (vera-skip-backward-literal) - (progn (store-match-data '(nil nil)) - (if bound (> (point) bound) t)))) - (match-end 0)) + (let (ret) + (while (and (setq ret (re-search-backward regexp bound noerror)) + (vera-skip-backward-literal) + (if bound (> (point) bound) t))) + ret)) (defun vera-forward-syntactic-ws (&optional lim skip-directive) "Forward skip of syntactic whitespace." diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index a1bd32a313d..c549d066b64 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -19,7 +19,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 922de2d54c6..5b5c13342ad 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -11,7 +11,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -76,8 +76,8 @@ :version "20.3") (defcustom which-func-modes - '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode - sh-mode fortran-mode f90-mode ada-mode) + '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode python-mode + makefile-mode sh-mode fortran-mode f90-mode ada-mode) "List of major modes for which Which Function mode should be used. For other modes it is disabled. If this is equal to t, then Which Function mode is enabled in any major mode that supports it." diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el index 0beca9e985e..d2ec1781a54 100644 --- a/lisp/progmodes/xscheme.el +++ b/lisp/progmodes/xscheme.el @@ -10,7 +10,7 @@ ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) +;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, |