summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/compile.el15
-rw-r--r--lisp/progmodes/flymake.el25
-rw-r--r--lisp/progmodes/grep.el75
-rw-r--r--lisp/progmodes/octave-inf.el2
-rw-r--r--lisp/progmodes/vera-mode.el82
5 files changed, 108 insertions, 91 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 94def936fb9..0c57e6f55b1 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -607,7 +607,9 @@ Faces `compilation-error-face', `compilation-warning-face',
(defcustom compilation-auto-jump-to-first-error nil
"If non-nil, automatically jump to the first error after `compile'."
- :type 'boolean)
+ :type 'boolean
+ :group 'compilation
+ :version "23.1")
(defvar compilation-auto-jump-to-next nil
"If non-nil, automatically jump to the next error encountered.")
@@ -934,7 +936,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
@@ -944,10 +946,7 @@ 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))))))
@@ -1042,6 +1041,10 @@ 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)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 4903d7d26ec..7e353247b04 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -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/grep.el b/lisp/progmodes/grep.el
index 24d5eababc6..fd93015ab2c 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -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 ()
@@ -377,38 +383,51 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
;;;###autoload
(defun grep-compute-defaults ()
- (let ((host-id
- (intern (or (file-remote-p default-directory 'host) "localhost"))))
+ ;; 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, then they are kept in the
- ;; variables' property host-id for reuse.
+ ;; computed for every host once.
(setq grep-command
- (or (get 'grep-command host-id)
- (eval (car (get 'grep-command 'standard-value))))
+ (or (cadr (assq 'grep-command host-defaults))
+ (cadr (assq 'grep-command defaults)))
grep-template
- (or (get 'grep-template host-id)
- (eval (car (get 'grep-template 'standard-value))))
+ (or (cadr (assq 'grep-template host-defaults))
+ (cadr (assq 'grep-template defaults)))
grep-use-null-device
- (or (get 'grep-use-null-device host-id)
- (eval (car (get 'grep-use-null-device 'standard-value))))
+ (or (cadr (assq 'grep-use-null-device host-defaults))
+ (cadr (assq 'grep-use-null-device defaults)))
grep-find-command
- (or (get 'grep-find-command host-id)
- (eval (car (get 'grep-find-command 'standard-value))))
+ (or (cadr (assq 'grep-find-command host-defaults))
+ (cadr (assq 'grep-find-command defaults)))
grep-find-template
- (or (get 'grep-find-template host-id)
- (eval (car (get 'grep-find-template 'standard-value))))
+ (or (cadr (assq 'grep-find-template host-defaults))
+ (cadr (assq 'grep-find-template defaults)))
grep-find-use-xargs
- (or (get 'grep-find-use-xargs host-id)
- (eval (car (get 'grep-find-use-xargs 'standard-value))))
+ (or (cadr (assq 'grep-find-use-xargs host-defaults))
+ (cadr (assq 'grep-find-use-xargs defaults)))
grep-highlight-matches
- (or (get 'grep-highlight-matches host-id)
- (eval (car (get 'grep-highlight-matches 'standard-value)))))
+ (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
@@ -492,13 +511,19 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
t))))
;; Save defaults for this host.
- (put 'grep-command host-id grep-command)
- (put 'grep-template host-id grep-template)
- (put 'grep-use-null-device host-id grep-use-null-device)
- (put 'grep-find-command host-id grep-find-command)
- (put 'grep-find-template host-id grep-find-template)
- (put 'grep-find-use-xargs host-id grep-find-use-xargs)
- (put 'grep-highlight-matches host-id grep-highlight-matches)))
+ (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/octave-inf.el b/lisp/progmodes/octave-inf.el
index 63f9af50c1e..b46510b5ac9 100644
--- a/lisp/progmodes/octave-inf.el
+++ b/lisp/progmodes/octave-inf.el
@@ -42,7 +42,7 @@
:group 'octave-inferior)
(defcustom inferior-octave-prompt
- "\\(^octave\\(\\|.bin\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
+ "\\(^octave\\(\\|.bin\\|.exe\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ "
"Regexp to match prompts for the inferior Octave process."
:type 'regexp
:group 'octave-inferior)
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index 7117ffd15e8..c70ec7eab6c 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -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."