aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1991-12-21 09:14:03 +0000
committerJim Blandy1991-12-21 09:14:03 +0000
commitaa228418e97d3b6aada0da50ee0419c5c23f726c (patch)
tree54f5de32b8b44b028fc96ebda21b9d11f96916fe
parent0231f2dce81e3f5118c5c2eecec6081ba888e03a (diff)
downloademacs-aa228418e97d3b6aada0da50ee0419c5c23f726c.tar.gz
emacs-aa228418e97d3b6aada0da50ee0419c5c23f726c.zip
*** empty log message ***
-rw-r--r--lisp/diff.el88
-rw-r--r--lisp/find-dired.el177
-rw-r--r--lisp/mail/emacsbug.el3
-rw-r--r--lisp/mail/mailabbrev.el29
-rw-r--r--lisp/mail/mailalias.el32
-rw-r--r--lisp/mail/rmail.el6
-rw-r--r--lisp/mail/sendmail.el22
-rw-r--r--lisp/man.el10
-rw-r--r--lisp/map-ynp.el44
-rw-r--r--lisp/progmodes/compile.el13
-rw-r--r--lisp/progmodes/etags.el102
-rw-r--r--lisp/textmodes/fill.el57
12 files changed, 352 insertions, 231 deletions
diff --git a/lisp/diff.el b/lisp/diff.el
index 4dd8b2e57ff..7b92c6a4314 100644
--- a/lisp/diff.el
+++ b/lisp/diff.el
@@ -29,12 +29,22 @@
29;; containing 0 or more arguments which are passed on to `diff'. 29;; containing 0 or more arguments which are passed on to `diff'.
30;; NOTE: This is not an ordinary hook; it may not be a list of functions.") 30;; NOTE: This is not an ordinary hook; it may not be a list of functions.")
31 31
32;; - fpb@ittc.wec.com - Sep 25, 1990
33;; Added code to support sccs diffing.
34;; also fixed one minor glitch in the
35;; search for the pattern. If you only 1 addition you won't find the end
36;; of the pattern (minor)
37
38;;
32(defvar diff-switches nil 39(defvar diff-switches nil
33 "*A list of switches to pass to the diff program.") 40 "*A list of switches to pass to the diff program.")
34 41
35(defvar diff-search-pattern "^\\([0-9]\\|\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\)" 42(defvar diff-search-pattern "^\\([0-9]\\|\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\)"
36 "Regular expression that delineates difference regions in diffs.") 43 "Regular expression that delineates difference regions in diffs.")
37 44
45(defvar diff-rcs-extension ",v"
46 "*Extension to find RCS file, some systems do not use ,v")
47
38;; Initialize the keymap if it isn't already 48;; Initialize the keymap if it isn't already
39(if (boundp 'diff-mode-map) 49(if (boundp 'diff-mode-map)
40 nil 50 nil
@@ -75,22 +85,78 @@ and what appears to be it's backup for OLD."
75 (message "Comparing files %s %s..." new old) 85 (message "Comparing files %s %s..." new old)
76 (setq new (expand-file-name new) 86 (setq new (expand-file-name new)
77 old (expand-file-name old)) 87 old (expand-file-name old))
78 (let ((buffer-read-only nil) 88 (diff-internal-diff "diff" (append diff-switches (list new old)) nil))
79 (sw diff-switches)) 89
90(defun diff-sccs (new)
91 "Find and display the differences between OLD and SCCS files."
92 (interactive
93 (let (newf)
94 (list
95 (setq newf (buffer-file-name)
96 newf (if (and newf (file-exists-p newf))
97 (read-file-name
98 (concat "Diff new file: ("
99 (file-name-nondirectory newf) ") ")
100 nil newf t)
101 (read-file-name "Diff new file: " nil nil t))))))
102
103 (message "Comparing SCCS file %s..." new)
104 (setq new (expand-file-name new))
105 (if (file-exists-p (concat
106 (file-name-directory new)
107 "SCCS/s."
108 (file-name-nondirectory new)))
109 (diff-internal-diff "sccs"
110 (append '("diffs") diff-switches (list new))
111 2)
112 (error "%s does not exist"
113 (concat (file-name-directory new) "SCCS/s."
114 (file-name-nondirectory new)))))
115
116(defun diff-rcs (new)
117 "Find and display the differences between OLD and RCS files."
118 (interactive
119 (let (newf)
120 (list
121 (setq newf (buffer-file-name)
122 newf (if (and newf (file-exists-p newf))
123 (read-file-name
124 (concat "Diff new file: ("
125 (file-name-nondirectory newf) ") ")
126 nil newf t)
127 (read-file-name "Diff new file: " nil nil t))))))
128
129 (message "Comparing RCS file %s..." new)
130 (let* ((fullname (expand-file-name new))
131 (rcsfile (concat (file-name-directory fullname)
132 "RCS/"
133 (file-name-nondirectory fullname)
134 diff-rcs-extension)))
135 (if (file-exists-p rcsfile)
136 (diff-internal-diff "rcsdiff" (append diff-switches (list fullname)) 4)
137 (error "%s does not exist" rcsfile))))
138
139(defun diff-internal-diff (diff-command sw strip)
140 (let ((buffer-read-only nil))
80 (with-output-to-temp-buffer "*Diff Output*" 141 (with-output-to-temp-buffer "*Diff Output*"
81 (buffer-disable-undo standard-output) 142 (buffer-disable-undo standard-output)
82 (save-excursion 143 (save-excursion
83 (set-buffer standard-output) 144 (set-buffer standard-output)
84 (erase-buffer) 145 (erase-buffer)
85 (apply 'call-process "diff" nil t nil 146 (apply 'call-process diff-command nil t nil sw)))
86 (append diff-switches (list old new)))))
87 (set-buffer "*Diff Output*") 147 (set-buffer "*Diff Output*")
88 (goto-char (point-min)) 148 (goto-char (point-min))
89 (while sw 149 (while sw
90 (if (string= (car sw) "-c") 150 (if (string= (car sw) "-c")
91 ;; strip leading filenames from context diffs 151 ;; strip leading filenames from context diffs
92 (progn (forward-line 2) (delete-region (point-min) (point)))) 152 (progn (forward-line 2) (delete-region (point-min) (point))))
93 (setq sw (cdr sw)))) 153 (if (and (string= (car sw) "-C") (string= "sccs" diff-command))
154 ;; strip stuff from SCCS context diffs
155 (progn (forward-line 2) (delete-region (point-min) (point))))
156 (setq sw (cdr sw)))
157 (if strip
158 ;; strip stuff from SCCS context diffs
159 (progn (forward-line strip) (delete-region (point-min) (point)))))
94 (diff-mode) 160 (diff-mode)
95 (if (string= "0" diff-total-differences) 161 (if (string= "0" diff-total-differences)
96 (let ((buffer-read-only nil)) 162 (let ((buffer-read-only nil))
@@ -103,7 +169,7 @@ and what appears to be it's backup for OLD."
103 (goto-char (point-max))))) 169 (goto-char (point-max)))))
104 (setq diff-current-difference "1"))) 170 (setq diff-current-difference "1")))
105 171
106;; Take a buffer full of Unix diff output and go into a mode to easily 172;; Take a buffer full of Unix diff output and go into a mode to easily
107;; see the next and previous difference 173;; see the next and previous difference
108(defun diff-mode () 174(defun diff-mode ()
109 "Diff Mode is used by \\[diff] for perusing the output from the diff program. 175 "Diff Mode is used by \\[diff] for perusing the output from the diff program.
@@ -129,8 +195,8 @@ All normal editing commands are turned off. Instead, these are available:
129 (int-to-string (diff-count-differences)))) 195 (int-to-string (diff-count-differences))))
130 196
131(defun diff-next-difference (n) 197(defun diff-next-difference (n)
132 "In diff mode, go to the beginning of the next difference as delimited 198 "Go to the beginning of the next difference.
133by `diff-search-pattern'." 199Differences are delimited by `diff-search-pattern'."
134 (interactive "p") 200 (interactive "p")
135 (if (< n 0) (diff-previous-difference (- n)) 201 (if (< n 0) (diff-previous-difference (- n))
136 (if (zerop n) () 202 (if (zerop n) ()
@@ -153,8 +219,8 @@ by `diff-search-pattern'."
153 (goto-char (point-min))))) 219 (goto-char (point-min)))))
154 220
155(defun diff-previous-difference (n) 221(defun diff-previous-difference (n)
156 "In diff mode, go the the beginning of the previous difference as delimited 222 "Go the the beginning of the previous difference.
157by `diff-search-pattern'." 223Differences are delimited by `diff-search-pattern'."
158 (interactive "p") 224 (interactive "p")
159 (if (< n 0) (diff-next-difference (- n)) 225 (if (< n 0) (diff-next-difference (- n))
160 (if (zerop n) () 226 (if (zerop n) ()
@@ -172,7 +238,7 @@ by `diff-search-pattern'."
172 (goto-char (point-min))))) 238 (goto-char (point-min)))))
173 239
174(defun diff-show-difference (n) 240(defun diff-show-difference (n)
175 "Show difference number N (prefix arg)." 241 "Show difference number N (prefix argument)."
176 (interactive "p") 242 (interactive "p")
177 (let ((cur (string-to-int diff-current-difference))) 243 (let ((cur (string-to-int diff-current-difference)))
178 (cond ((or (= n cur) 244 (cond ((or (= n cur)
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 630953121a2..472797b15dc 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -1,7 +1,8 @@
1;;; find-dired.el -- Run a `find' command and dired the result. 1;;; find-dired.el -- Run a `find' command and dired the output
2;;; Copyright (C) 1991 Roland McGrath 2;;; Copyright (C) 1991 Roland McGrath
3 3
4(defconst find-dired-version "$Id: find-dired.el,v 1.7 1991/06/20 08:50:20 sk RelBeta $") 4(defconst find-dired-version (substring "$Revision: 1.9 $" 11 -2)
5 "$Id: find-dired.el,v 1.9 1991/11/11 13:24:31 sk Exp $")
5 6
6;;; This program is free software; you can redistribute it and/or modify 7;;; This program is free software; you can redistribute it and/or modify
7;;; it under the terms of the GNU General Public License as published by 8;;; it under the terms of the GNU General Public License as published by
@@ -18,43 +19,67 @@
18;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 19;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
19;;; 02139, USA. 20;;; 02139, USA.
20;;; 21;;;
21;;; Send bug reports to roland@gnu.ai.mit.edu. 22;; LISPDIR ENTRY for the Elisp Archive ===============================
22 23;; LCD Archive Entry:
23;;; To use this file, byte-compile it, install it somewhere 24;; find-dired|Roland McGrath, Sebastian Kremer
24;;; in your load-path, and put: 25;; |roland@gnu.ai.mit.edu, sk@thp.uni-koeln.de
25;;; (autoload 'find-dired "find-dired" nil t) 26;; |Run a `find' command and dired the output
26;;; (autoload 'lookfor-dired "find-dired" nil t) 27;; |$Date: 1991/11/11 13:24:31 $|$Revision: 1.9 $|
27;;; in your .emacs, or site-init.el, etc.
28;;; To bind it to a key, put, e.g.:
29;;; (global-set-key "\C-cf" 'find-dired)
30;;; (global-set-key "\C-cl" 'lookfor-dired)
31;;; in your .emacs.
32 28
33(require 'dired) 29;; INSTALLATION ======================================================
34 30
35(defvar find-args nil 31;; To use this file, byte-compile it, install it somewhere in your
36 "Last arguments given to `find' by \\[find-dired].") 32;; load-path, and put:
33
34;; (autoload 'find-dired "find-dired" nil t)
35;; (autoload 'find-name-dired "find-dired" nil t)
36;; (autoload 'find-grep-dired "find-dired" nil t)
37
38;; in your ~/.emacs, or site-init.el, etc.
39
40;; To bind it to a key, put, e.g.:
41;;
42;; (global-set-key "\C-cf" 'find-dired)
43;; (global-set-key "\C-cn" 'find-name-dired)
44;; (global-set-key "\C-cl" 'find-grep-dired)
45;;
46;; in your ~/.emacs.
47
48(require 'dired)
49(provide 'find-dired)
37 50
51;;;###autoload
38(defvar find-ls-option (if (eq system-type 'berkeley-unix) "-ls" 52(defvar find-ls-option (if (eq system-type 'berkeley-unix) "-ls"
39 "-exec ls -ldi {} \\;") 53 "-exec ls -ldi {} \\;")
40 "Option to `find' to produce an `ls -l'-type listing.") 54 "*Option to `find' to produce an `ls -l'-type listing.")
55
56;;;###autoload
57(defvar find-grep-options (if (eq system-type 'berkeley-unix) "-s" "-l")
58 "*Option to grep to be as silent as possible.
59On Berkeley systems, this is `-s', for others it seems impossible to
60suppress all output, so `-l' is used to print nothing more than the
61file name.")
62
63(defvar find-args nil
64 "Last arguments given to `find' by \\[find-dired].")
41 65
42;;;###autoload 66;;;###autoload
43(defun find-dired (dir args) 67(defun find-dired (dir args)
44 "Run `find' and go into dired-mode on a buffer of the output. 68 "Run `find' and go into dired-mode on a buffer of the output.
45The command run is \"find . \\( ARGS \\) -ls\" (after changing into DIR)." 69The command run (after changing into DIR) is
70
71 find . \\( ARGS \\) -ls"
46 (interactive (list (read-file-name "Run find in directory: " nil "" t) 72 (interactive (list (read-file-name "Run find in directory: " nil "" t)
47 (if (featurep 'gmhist) 73 (if (featurep 'gmhist)
48 (read-with-history-in 'find-args-history 74 (read-with-history-in 'find-args-history
49 "Run find (with args): ") 75 "Run find (with args): ")
50 (read-string "Run find (with args): " find-args)))) 76 (read-string "Run find (with args): " find-args))))
51 (if (equal dir "") 77 ;; Expand DIR ("" means default-directory), and make sure it has a
52 (setq dir default-directory)) 78 ;; trailing slash.
53 ;; Expand DIR, and make sure it has a trailing slash.
54 (setq dir (file-name-as-directory (expand-file-name dir))) 79 (setq dir (file-name-as-directory (expand-file-name dir)))
55 ;; Check that it's really a directory. 80 ;; Check that it's really a directory.
56 (or (file-directory-p dir) 81 (or (file-directory-p dir)
57 (error "%s is not a directory!" dir)) 82 (error "find-dired needs a directory: %s" dir))
58 (switch-to-buffer (get-buffer-create "*Find*")) 83 (switch-to-buffer (get-buffer-create "*Find*"))
59 (widen) 84 (widen)
60 (kill-all-local-variables) 85 (kill-all-local-variables)
@@ -64,25 +89,63 @@ The command run is \"find . \\( ARGS \\) -ls\" (after changing into DIR)."
64 find-args args 89 find-args args
65 args (concat "find . " (if (string= args "") "" 90 args (concat "find . " (if (string= args "") ""
66 (concat "\\( " args " \\) ")) find-ls-option)) 91 (concat "\\( " args " \\) ")) find-ls-option))
67 (insert " " args "\n" 92 (dired-mode dir "-gils");; find(1)'s -ls corresponds to `ls -gilds'
68 " " dir ":\n") 93 ;; (but we don't want -d, of course)
94 ;; Set subdir-alist so that Tree Dired will work (but STILL NOT with
95 ;; dired-nstd.el):
96 (set (make-local-variable 'dired-subdir-alist)
97 (list (cons default-directory (point-marker)))) ; we are at point-min
98 (setq buffer-read-only nil)
99 ;; Subdir headlerline must come first because the first marker in
100 ;; subdir-alist points there.
101 (insert " " dir ":\n")
102 ;; Make second line a ``find'' line in analogy to the ``total'' or
103 ;; ``wildcard'' line.
104 (insert " " args "\n")
105 ;; Start the find process
69 (set-process-filter (start-process-shell-command "find" 106 (set-process-filter (start-process-shell-command "find"
70 (current-buffer) args) 107 (current-buffer) args)
71 'find-dired-filter) 108 (function find-dired-filter))
72 (set-process-sentinel (get-buffer-process (current-buffer)) 109 (set-process-sentinel (get-buffer-process (current-buffer))
73 'find-dired-sentinel) 110 (function find-dired-sentinel))
74 (dired-mode)
75 (setq mode-line-process '(": %s"))) 111 (setq mode-line-process '(": %s")))
76 112
77;;;###autoload 113;;;###autoload
78(defun find-name-dired (dir pattern) 114(defun find-name-dired (dir pattern)
79 "Search DIR recursively for files matching the globbing pattern PATTERN, 115 "Search DIR recursively for files matching the globbing pattern PATTERN,
80and run dired on those files." 116and run dired on those files.
81 (interactive "DSearch directory: \nsSearch directory %s for: ") 117PATTERN is a shell wildcard (not an Emacs regexp) and need not be quoted.
118The command run (after changing into DIR) is
119
120 find . -name 'PATTERN' -ls"
121 (interactive
122 "DFind-name (directory): \nsFind-name (filename wildcard): ")
82 (find-dired dir (concat "-name '" pattern "'"))) 123 (find-dired dir (concat "-name '" pattern "'")))
83 124
125;; This functionality suggested by
126;; From: oblanc@watcgl.waterloo.edu (Olivier Blanc)
127;; Subject: find-dired, lookfor-dired
128;; Date: 10 May 91 17:50:00 GMT
129;; Organization: University of Waterloo
130
131(fset 'lookfor-dired 'find-grep-dired)
132;;;###autoload
133(defun find-grep-dired (dir args)
134 "Find files in DIR containing a regexp ARG and start Dired on output.
135The command run (after changing into DIR) is
136
137 find . -exec grep -s ARG {} \\\; -ls
138
139Thus ARG can also contain additional grep options."
140 (interactive "DFind-grep (directory): \nsFind-grep (grep args): ")
141 ;; find -exec doesn't allow shell i/o redirections in the command,
142 ;; or we could use `grep -l >/dev/null'
143 (find-dired dir
144 (concat "-exec grep " find-grep-options " " args " {} \\\; ")))
145
84(defun find-dired-filter (proc string) 146(defun find-dired-filter (proc string)
85 ;; Filter for \\[find-dired] processes. 147 ;; Filter for \\[find-dired] processes.
148 (dired-log "``%s''\n" string)
86 (let ((buf (process-buffer proc))) 149 (let ((buf (process-buffer proc)))
87 (if (buffer-name buf) ; not killed? 150 (if (buffer-name buf) ; not killed?
88 (save-excursion 151 (save-excursion
@@ -99,7 +162,13 @@ and run dired on those files."
99 (forward-line 1)) 162 (forward-line 1))
100 (while (looking-at "^") 163 (while (looking-at "^")
101 (insert " ") 164 (insert " ")
102 (forward-line 1)))))) 165 (forward-line 1))
166 ;; Convert ` ./FILE' to ` FILE'
167 ;; This would lose if the current chunk of output
168 ;; starts or ends within the ` ./', so backup up a bit:
169 (goto-char (- end 3)) ; no error if < 0
170 (while (search-forward " ./" nil t)
171 (delete-region (point) (- (point) 2)))))))
103 ;; The buffer has been killed. 172 ;; The buffer has been killed.
104 (delete-process proc)))) 173 (delete-process proc))))
105 174
@@ -129,51 +198,5 @@ Wildcards and redirection are handle as usual in the shell."
129 (if (eq system-type 'vax-vms) 198 (if (eq system-type 'vax-vms)
130 (apply 'start-process name buffer args) 199 (apply 'start-process name buffer args)
131 (start-process name buffer shell-file-name "-c" 200 (start-process name buffer shell-file-name "-c"
132 (concat "exec " (mapconcat 'identity args " "))))) 201 (concat "exec " (mapconcat 'identity args " "))))))
133 )
134 202
135;; From: oblanc@watcgl.waterloo.edu (Olivier Blanc)
136;; Subject: find-dired, lookfor-dired
137;; Date: 10 May 91 17:50:00 GMT
138;; Organization: University of Waterloo
139
140;; I added a functiopn to the find-dired.el file:
141;; The function is a lookfor-dired and is used to search a string
142;; a subtree:
143
144;;;###autoload
145(defun lookfor-dired (dir args)
146 "Find files in DIR containing a regexp ARG and go into dired-mode on the output.
147The command run is
148
149 \"find . -exec grep -l ARG {} \\\; -ls\"
150
151\(after changing into DIR)."
152 (interactive (list (read-file-name "Run find in directory: " nil "" t)
153 (read-string "Run find (with args): " find-args)))
154 (if (equal dir "")
155 (setq dir default-directory))
156 ;; Expand DIR, and make sure it has a trailing slash.
157 (setq dir (file-name-as-directory (expand-file-name dir)))
158 ;; Check that it's really a directory.
159 (or (file-directory-p dir)
160 (error "%s is not a directory!" dir))
161 (switch-to-buffer (get-buffer-create "*Find*"))
162 (widen)
163 (kill-all-local-variables)
164 (setq buffer-read-only nil)
165 (erase-buffer)
166 (setq default-directory dir
167 find-args args
168 args (concat "find . -exec grep -l " args " {} \\\; -ls"))
169 (insert " " args "\n"
170 " " dir ":\n")
171 (set-process-filter (start-process-shell-command "find"
172 (current-buffer) args)
173 'find-dired-filter)
174 (set-process-sentinel (get-buffer-process (current-buffer))
175 'find-dired-sentinel)
176 (dired-mode)
177 (setq mode-line-process '(": %s")))
178
179(provide 'find-dired)
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 061fd30ee39..f65e665d051 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -27,8 +27,9 @@
27(defvar bug-gnu-emacs "bug-gnu-emacs@prep.ai.mit.edu" 27(defvar bug-gnu-emacs "bug-gnu-emacs@prep.ai.mit.edu"
28 "Address of site maintaining mailing list for GNU Emacs bugs.") 28 "Address of site maintaining mailing list for GNU Emacs bugs.")
29 29
30;;;###autoload
30(defun report-emacs-bug (topic) 31(defun report-emacs-bug (topic)
31 "Report a bug in Gnu emacs. 32 "Report a bug in GNU Emacs.
32Prompts for bug subject. Leaves you in a mail buffer." 33Prompts for bug subject. Leaves you in a mail buffer."
33 (interactive "sBug Subject: ") 34 (interactive "sBug Subject: ")
34 (mail nil bug-gnu-emacs topic) 35 (mail nil bug-gnu-emacs topic)
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index ef9ab8cea0e..5efa9eadd4b 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -120,11 +120,12 @@
120 120
121;; originally defined in sendmail.el - used to be an alist, now is a table. 121;; originally defined in sendmail.el - used to be an alist, now is a table.
122(defvar mail-aliases nil 122(defvar mail-aliases nil
123 "Word-abbrev table of mail address aliases. 123 "Abbrev table of mail address aliases.
124If this is nil, it means the aliases have not yet been initialized and 124If this is nil, it means the aliases have not yet been initialized and
125should be read from the .mailrc file. (This is distinct from there being 125should be read from the .mailrc file. (This is distinct from there being
126no aliases, which is represented by this being a table with no entries.)") 126no aliases, which is represented by this being a table with no entries.)")
127 127
128;;;###autoload
128(defun mail-aliases-setup () 129(defun mail-aliases-setup ()
129 (if (and (not (vectorp mail-aliases)) 130 (if (and (not (vectorp mail-aliases))
130 (file-exists-p (mail-abbrev-mailrc-file))) 131 (file-exists-p (mail-abbrev-mailrc-file)))
@@ -217,6 +218,7 @@ also want something like \",\\n \" to get each address on its own line.")
217;; originally defined in mailalias.el ; build-mail-aliases calls this with 218;; originally defined in mailalias.el ; build-mail-aliases calls this with
218;; stuff parsed from the .mailrc file. 219;; stuff parsed from the .mailrc file.
219;; 220;;
221;;;###autoload
220(defun define-mail-alias (name definition &optional from-mailrc-file) 222(defun define-mail-alias (name definition &optional from-mailrc-file)
221 "Define NAME as a mail-alias that translates to DEFINITION. 223 "Define NAME as a mail-alias that translates to DEFINITION.
222If DEFINITION contains multiple addresses, seperate them with commas." 224If DEFINITION contains multiple addresses, seperate them with commas."
@@ -295,10 +297,9 @@ If DEFINITION contains multiple addresses, seperate them with commas."
295 297
296 298
297(defun mail-abbrev-expand-hook () 299(defun mail-abbrev-expand-hook ()
298 "For use as the fourth arg to define-abbrev. 300 "For use as the fourth arg to `define-abbrev'.
299 After expanding a mail-abbrev, if fill-mode is on and we're past the 301After expanding a mail alias, if Auto Fill mode is on and we're past the
300fill-column, break the line at the previous comma, and indent the next 302fill column, break the line at the previous comma, and indent the next line."
301line."
302 (save-excursion 303 (save-excursion
303 (let ((p (point)) 304 (let ((p (point))
304 bol) 305 bol)
@@ -337,7 +338,7 @@ This should be set to match those mail fields in which you want abbreviations
337turned on.") 338turned on.")
338 339
339(defvar mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table) 340(defvar mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table)
340 "The syntax table which is current in send-mail mode.") 341 "The syntax table which is current in mail mode.")
341 342
342(defvar mail-mode-header-syntax-table 343(defvar mail-mode-header-syntax-table
343 (let ((tab (copy-syntax-table text-mode-syntax-table))) 344 (let ((tab (copy-syntax-table text-mode-syntax-table)))
@@ -362,7 +363,9 @@ turned on.")
362 "The syntax table used when the cursor is in a mail-address header. 363 "The syntax table used when the cursor is in a mail-address header.
363mail-mode-syntax-table is used when the cursor is not in an address header.") 364mail-mode-syntax-table is used when the cursor is not in an address header.")
364 365
365 366;; This hook is run before trying to expand an abbrev in a mail buffer.
367;; It determines whether point is in the header, and chooses which
368;; abbrev table accordingly.
366(defun sendmail-pre-abbrev-expand-hook () 369(defun sendmail-pre-abbrev-expand-hook ()
367 (if mail-abbrev-aliases-need-to-be-resolved 370 (if mail-abbrev-aliases-need-to-be-resolved
368 (mail-resolve-all-aliases)) 371 (mail-resolve-all-aliases))
@@ -425,17 +428,5 @@ mail-mode-syntax-table is used when the cursor is not in an address header.")
425 (setq mail-aliases nil) 428 (setq mail-aliases nil)
426 (build-mail-aliases file)) 429 (build-mail-aliases file))
427 430
428
429;;; Patching it in:
430;;; Remove the entire file mailalias.el
431;;; Remove the definition of mail-aliases from sendmail.el
432;;; Add a call to mail-aliases-setup to mail-setup in sendmail.el
433;;; Remove the call to expand-mail-aliases from sendmail-send-it in sendmail.el
434;;; Remove the autoload of expand-mail-aliases from sendmail.el
435;;; Remove the autoload of build-mail-aliases from sendmail.el
436;;; Add an autoload of define-mail-alias
437
438(fmakunbound 'expand-mail-aliases)
439
440(provide 'mail-abbrevs) 431(provide 'mail-abbrevs)
441 432
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index 7201d0182e7..2765bd561f0 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -142,17 +142,27 @@ DEFINITION can be one or more mail addresses separated by commas."
142 (setq mail-aliases nil) 142 (setq mail-aliases nil)
143 (if (file-exists-p "~/.mailrc") 143 (if (file-exists-p "~/.mailrc")
144 (build-mail-aliases)))) 144 (build-mail-aliases))))
145 (let (tem) 145 ;; Strip leading and trailing blanks.
146 ;; ~/.mailrc contains addresses separated by spaces. 146 (if (string-match "^[ \t]+" definition)
147 ;; mailers should expect addresses separated by commas. 147 (setq definition (substring definition (match-end 0))))
148 (while (setq tem (string-match "[^ \t,][ \t,]+" definition tem)) 148 (if (string-match "[ \t]+$" definition)
149 (if (= (match-end 0) (length definition)) 149 (setq definition (substring definition 0 (match-beginning 0))))
150 (setq definition (substring definition 0 (1+ tem))) 150 (let ((first (aref definition 0))
151 (setq definition (concat (substring definition 151 (last (aref definition (1- (length definition))))
152 0 (1+ tem)) 152 tem)
153 ", " 153 (if (and (= first last) (memq first '(?\' ?\")))
154 (substring definition (match-end 0)))) 154 ;; Strip quotation marks.
155 (setq tem (+ 3 tem)))) 155 (setq definition (substring definition 1 (1- (length definition))))
156 ;; ~/.mailrc contains addresses separated by spaces.
157 ;; mailers should expect addresses separated by commas.
158 (while (setq tem (string-match "[^ \t,][ \t,]+" definition tem))
159 (if (= (match-end 0) (length definition))
160 (setq definition (substring definition 0 (1+ tem)))
161 (setq definition (concat (substring definition
162 0 (1+ tem))
163 ", "
164 (substring definition (match-end 0))))
165 (setq tem (+ 3 tem)))))
156 (setq tem (assoc name mail-aliases)) 166 (setq tem (assoc name mail-aliases))
157 (if tem 167 (if tem
158 (rplacd tem definition) 168 (rplacd tem definition)
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index fcb55c90dd9..8c966ce9604 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1,5 +1,5 @@
1;; "RMAIL" mail reader for Emacs. 1;; "RMAIL" mail reader for Emacs.
2;; Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc. 2;; Copyright (C) 1985, 1986, 1987, 1988, 1991 Free Software Foundation, Inc.
3 3
4;; This file is part of GNU Emacs. 4;; This file is part of GNU Emacs.
5 5
@@ -638,7 +638,7 @@ argument causes us to read a file name and use that file as the inbox."
638 (concat "^[\^_]?\\(" 638 (concat "^[\^_]?\\("
639 "From [^ \n]*\\(\\|\".*\"[^ \n]*\\) ?[^ \n]* [^ \n]* *" 639 "From [^ \n]*\\(\\|\".*\"[^ \n]*\\) ?[^ \n]* [^ \n]* *"
640 "[0-9]* [0-9:]*\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) " ; EDT, -0500 640 "[0-9]* [0-9:]*\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) " ; EDT, -0500
641 "19[0-9]* *\\(remote from [^\n]*\\)?$\\|" 641 "[0-9]+ *\\(remote from [^\n]*\\)?$\\|"
642 mmdf-delim1 "\\|" 642 mmdf-delim1 "\\|"
643 "^BABYL OPTIONS:\\|" 643 "^BABYL OPTIONS:\\|"
644 "\^L\n[01],\\)") nil t) 644 "\^L\n[01],\\)") nil t)
@@ -684,7 +684,7 @@ argument causes us to read a file name and use that file as the inbox."
684 (goto-char start)) 684 (goto-char start))
685 (let ((case-fold-search nil)) 685 (let ((case-fold-search nil))
686 (if (re-search-forward 686 (if (re-search-forward
687 "^From \\([^ ]*\\(\\|\".*\"[^ ]*\\)\\) ?\\([^ ]*\\) \\([^ ]*\\) *\\([0-9]*\\) \\([0-9:]*\\)\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) 19\\([0-9]*\\) *\\(remote from [^\n]*\\)?\n" nil t) 687 "^From \\([^ ]*\\(\\|\".*\"[^ ]*\\)\\) ?\\([^ ]*\\) \\([^ ]*\\) *\\([0-9]*\\) \\([0-9:]*\\)\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) [0-9][0-9]\\([0-9]*\\) *\\(remote from [^\n]*\\)?\n" nil t)
688 (replace-match 688 (replace-match
689 (concat 689 (concat
690 "Mail-from: \\&" 690 "Mail-from: \\&"
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index dbb8fc8d5a1..709f4d880a7 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -50,11 +50,6 @@ The headers are be delimited by a line which is mail-header-separator.")
50*Name of file to write all outgoing messages in, or nil for none. 50*Name of file to write all outgoing messages in, or nil for none.
51Do not use an rmail file here! Instead, use its inbox file.") 51Do not use an rmail file here! Instead, use its inbox file.")
52 52
53;;;###autoload
54(defvar mail-aliases t "\
55Alias of mail address aliases,
56or t meaning should be initialized from .mailrc.")
57
58(defvar mail-default-reply-to nil 53(defvar mail-default-reply-to nil
59 "*Address to insert as default Reply-to field of outgoing messages.") 54 "*Address to insert as default Reply-to field of outgoing messages.")
60 55
@@ -92,22 +87,9 @@ so you can edit or delete these lines.")
92 (setq mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table)) 87 (setq mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table))
93 (modify-syntax-entry ?% ". " mail-mode-syntax-table))) 88 (modify-syntax-entry ?% ". " mail-mode-syntax-table)))
94 89
95(autoload 'build-mail-aliases "mailalias"
96 "Read mail aliases from ~/.mailrc and set mail-aliases."
97 nil)
98
99(autoload 'expand-mail-aliases "mailalias"
100 "Expand all mail aliases in suitable header fields found between BEG and END.
101Suitable header fields are To, CC and BCC."
102 nil)
103
104(defun mail-setup (to subject in-reply-to cc replybuffer actions) 90(defun mail-setup (to subject in-reply-to cc replybuffer actions)
105 (setq mail-send-actions actions) 91 (setq mail-send-actions actions)
106 (if (eq mail-aliases t) 92 (mail-aliases-setup)
107 (progn
108 (setq mail-aliases nil)
109 (if (file-exists-p "~/.mailrc")
110 (build-mail-aliases))))
111 (setq mail-reply-buffer replybuffer) 93 (setq mail-reply-buffer replybuffer)
112 (goto-char (point-min)) 94 (goto-char (point-min))
113 (insert "To: ") 95 (insert "To: ")
@@ -258,8 +240,6 @@ the user from the mailer."
258 (replace-match "\n") 240 (replace-match "\n")
259 (backward-char 1) 241 (backward-char 1)
260 (setq delimline (point-marker)) 242 (setq delimline (point-marker))
261 (if mail-aliases
262 (expand-mail-aliases (point-min) delimline))
263 (goto-char (point-min)) 243 (goto-char (point-min))
264 ;; ignore any blank lines in the header 244 ;; ignore any blank lines in the header
265 (while (and (re-search-forward "\n\n\n*" delimline t) 245 (while (and (re-search-forward "\n\n\n*" delimline t)
diff --git a/lisp/man.el b/lisp/man.el
index 8f517627e08..790c8a0c1bd 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -136,6 +136,16 @@ where SECTION is the desired section of the manual, as in \"tty(4)\"."
136 (while (re-search-forward "\e[789]" nil t) 136 (while (re-search-forward "\e[789]" nil t)
137 (replace-match "")) 137 (replace-match ""))
138 138
139 ;; Convert o^H+ into o.
140 (goto-char (point-min))
141 (while (re-search-forward "o\010\\+" nil t)
142 (replace-match "o"))
143
144 ;; Nuke the dumb reformatting message
145 (goto-char (point-min))
146 (while (re-search-forward "Reformatting page. Wait... done\n\n" nil t)
147 (replace-match ""))
148
139 ;; Crunch blank lines 149 ;; Crunch blank lines
140 (goto-char (point-min)) 150 (goto-char (point-min))
141 (while (re-search-forward "\n\n\n\n*" nil t) 151 (while (re-search-forward "\n\n\n\n*" nil t)
diff --git a/lisp/map-ynp.el b/lisp/map-ynp.el
index db345d66ef8..606e4a82cb0 100644
--- a/lisp/map-ynp.el
+++ b/lisp/map-ynp.el
@@ -63,27 +63,27 @@ ESC or q to exit (skip all following objects); . (period) to act on the
63current object and then exit; or \\[help-command] to get help. 63current object and then exit; or \\[help-command] to get help.
64 64
65Returns the number of actions taken." 65Returns the number of actions taken."
66 (let ((old-help-form help-form) 66 (let* ((old-help-form help-form)
67 (help-form (cons 'map-y-or-n-p-help 67 (help-form (cons 'map-y-or-n-p-help
68 (or help '("object" "objects" "act on")))) 68 (or help '("object" "objects" "act on"))))
69 (actions 0) 69 (actions 0)
70 prompt 70 prompt
71 char 71 char
72 elt 72 elt
73 (next (if (or (symbolp list) 73 (next (if (or (symbolp list)
74 (subrp list) 74 (subrp list)
75 (compiled-function-p list) 75 (compiled-function-p list)
76 (and (consp list) 76 (and (consp list)
77 (eq (car list) 'lambda))) 77 (eq (car list) 'lambda)))
78 (function (lambda () 78 (function (lambda ()
79 (setq elt (funcall list)))) 79 (setq elt (funcall list))))
80 (function (lambda () 80 (function (lambda ()
81 (if list 81 (if list
82 (progn 82 (progn
83 (setq elt (car list) 83 (setq elt (car list)
84 list (cdr list)) 84 list (cdr list))
85 t) 85 t)
86 nil)))))) 86 nil))))))
87 (if (stringp prompter) 87 (if (stringp prompter)
88 (setq prompter (` (lambda (object) 88 (setq prompter (` (lambda (object)
89 (format (, prompter) object))))) 89 (format (, prompter) object)))))
@@ -122,7 +122,7 @@ Returns the number of actions taken."
122 (progn 122 (progn
123 (funcall actor elt) 123 (funcall actor elt)
124 (setq actions (1+ actions)))) 124 (setq actions (1+ actions))))
125 (while (setq elt (funcall next)) 125 (while (funcall next)
126 (if (eval (funcall prompter elt)) 126 (if (eval (funcall prompter elt))
127 (progn 127 (progn
128 (funcall actor elt) 128 (funcall actor elt)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 1d6856ee1b1..e85af18bc6c 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -45,15 +45,17 @@ It should read in the source files which have errors and set
45`compilation-error-list' to a list with an element for each error message 45`compilation-error-list' to a list with an element for each error message
46found. See that variable for more info.") 46found. See that variable for more info.")
47 47
48;;;###autoload
48(defvar compilation-buffer-name-function nil 49(defvar compilation-buffer-name-function nil
49 "Function to call with one argument, the name of the major mode of the 50 "*Function to call with one argument, the name of the major mode of the
50compilation buffer, to give the buffer a name. It should return a string. 51compilation buffer, to give the buffer a name. It should return a string.
51If nil, the name \"*compilation*\" is used for compilation buffers, 52If nil, the name \"*compilation*\" is used for compilation buffers,
52and the name \"*grep*\" is used for grep buffers. 53and the name \"*grep*\" is used for grep buffers.
53\(Actually, the name (concat "*" (downcase major-mode) "*") is used.)") 54\(Actually, the name (concat \"*\" (downcase major-mode) \"*\") is used.)")
54 55
56;;;###autoload
55(defvar compilation-finish-function nil 57(defvar compilation-finish-function nil
56 "Function to call when a compilation process finishes. 58 "*Function to call when a compilation process finishes.
57It is called with two arguments: the compilation buffer, and a string 59It is called with two arguments: the compilation buffer, and a string
58describing how the process finished.") 60describing how the process finished.")
59 61
@@ -279,8 +281,9 @@ means the default). The defaults for these variables are the global values of
279 (window-height)))) 281 (window-height))))
280 (select-window w)))) 282 (select-window w))))
281 ;; Start the compilation. 283 ;; Start the compilation.
282 (start-process-shell-command (downcase mode-name) outbuf command) 284 (set-process-sentinel (start-process-shell-command (downcase mode-name)
283 (set-process-sentinel (get-buffer-process outbuf) 285 outbuf
286 command)
284 'compilation-sentinel)) 287 'compilation-sentinel))
285 ;; Make it so the next C-x ` will use this buffer. 288 ;; Make it so the next C-x ` will use this buffer.
286 (setq compilation-last-buffer outbuf))) 289 (setq compilation-last-buffer outbuf)))
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index c5d39891dbc..92e0173a2a5 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -136,49 +136,67 @@ File names returned are absolute."
136 default 136 default
137 spec)))) 137 spec))))
138 138
139(defun tags-tag-match (tagname exact)
140 "Search for a match to the given tagname."
141 (if (not exact)
142 (search-forward tagname nil t)
143 (not (error-occurred
144 (while
145 (progn
146 (search-forward tagname)
147 (let ((before (char-syntax (char-after (1- (match-beginning 1)))))
148 (after (char-syntax (char-after (match-end 1)))))
149 (not (or (= before ?w) (= before ?_))
150 (= after ?w) (= after ?_)))
151 ))))
152 )
153 )
154
139(defun find-tag-noselect (tagname exact &optional next) 155(defun find-tag-noselect (tagname exact &optional next)
140 "Find a tag and return its buffer, but don't select or display it." 156 "Find a tag and return its buffer, but don't select or display it."
141 (let (buffer file linebeg startpos) 157 (let (buffer file linebeg startpos (obuf (current-buffer)))
142 (save-excursion 158 ;; save-excursion will do the wrong thing if the buffer containing the
143 (visit-tags-table-buffer) 159 ;; tag being searched for is current-buffer
144 (if (not next) 160 (unwind-protect
145 (goto-char (point-min)) 161 (progn
146 (setq tagname last-tag)) 162 (visit-tags-table-buffer)
147 (setq last-tag tagname) 163 (if (not next)
148 (while (progn 164 (goto-char (point-min))
149 (if (not (if exact 165 (setq tagname last-tag))
150 (re-search-forward (concat "\\W" tagname "\\W") nil t) 166 (setq last-tag tagname)
151 (search-forward tagname nil t))) 167 (while (progn
152 (error "No %sentries containing %s" 168 (if (not (tags-tag-match tagname exact))
153 (if next "more " "") tagname)) 169 (error "No %sentries matching %s"
154 (not (looking-at "[^\n\177]*\177")))) 170 (if next "more " "") tagname))
155 (search-forward "\177") 171 (not (looking-at "[^\n\177]*\177"))))
156 (setq file (expand-file-name (file-of-tag) 172 (search-forward "\177")
157 (file-name-directory tags-file-name))) 173 (setq file (expand-file-name (file-of-tag)
158 (setq linebeg 174 (file-name-directory tags-file-name)))
159 (buffer-substring (1- (point)) 175 (setq linebeg
160 (save-excursion (beginning-of-line) (point)))) 176 (buffer-substring (1- (point))
161 (search-forward ",") 177 (save-excursion (beginning-of-line) (point))))
162 (setq startpos (read (current-buffer))) 178 (search-forward ",")
163 (prog1 179 (setq startpos (read (current-buffer)))
164 (set-buffer (find-file-noselect file)) 180 (prog1
165 (widen) 181 (set-buffer (find-file-noselect file))
166 (push-mark) 182 (widen)
167 (let ((offset 1000) 183 (push-mark)
168 found 184 (let ((offset 1000)
169 (pat (concat "^" (regexp-quote linebeg)))) 185 found
170 (or startpos (setq startpos (point-min))) 186 (pat (concat "^" (regexp-quote linebeg))))
171 (while (and (not found) 187 (or startpos (setq startpos (point-min)))
172 (progn 188 (while (and (not found)
173 (goto-char (- startpos offset)) 189 (progn
174 (not (bobp)))) 190 (goto-char (- startpos offset))
175 (setq found 191 (not (bobp))))
176 (re-search-forward pat (startpos offset) t)) 192 (setq found
177 (setq offset (* 3 offset))) 193 (re-search-forward pat (+ startpos offset) t))
178 (or found 194 (setq offset (* 3 offset)))
179 (re-search-forward pat nil t) 195 (or found
180 (error "%s not found in %s" pat file))) 196 (re-search-forward pat nil t)
181 (beginning-of-line))) 197 (error "%s not found in %s" pat file)))
198 (beginning-of-line)))
199 (set-buffer obuf))
182 )) 200 ))
183 201
184;;;###autoload 202;;;###autoload
@@ -334,3 +352,5 @@ unless it has one in the tag table."
334 (point)))) 352 (point))))
335 (terpri) 353 (terpri)
336 (forward-line 1))))) 354 (forward-line 1)))))
355
356;; etags.el ends here
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index d7526a192b5..ad15fed9ee0 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -224,23 +224,40 @@ Optional third and fourth arguments JUSTIFY-FLAG and MAIL-FLAG:
224JUSTIFY-FLAG to justify paragraphs (prefix arg), 224JUSTIFY-FLAG to justify paragraphs (prefix arg),
225MAIL-FLAG for a mail message, i. e. don't fill header lines." 225MAIL-FLAG for a mail message, i. e. don't fill header lines."
226 (interactive "r\nP") 226 (interactive "r\nP")
227 (let (fill-prefix) 227 (save-restriction
228 (save-restriction 228 (save-excursion
229 (save-excursion 229 (goto-char min)
230 (goto-char min) 230 (beginning-of-line)
231 (if mailp 231 (if mailp
232 (while (looking-at "[^ \t\n]*:") 232 (while (looking-at "[^ \t\n]*:")
233 (forward-line 1))) 233 (forward-line 1)))
234 (narrow-to-region (point) max) 234 (narrow-to-region (point) max)
235 (while (progn 235 ;; Loop over paragraphs.
236 (skip-chars-forward " \t\n") 236 (while (progn (skip-chars-forward " \t\n") (not (eobp)))
237 (not (eobp))) 237 (beginning-of-line)
238 (setq fill-prefix 238 (let ((start (point))
239 (buffer-substring (point) (progn (beginning-of-line) (point)))) 239 fill-prefix fill-prefix-regexp)
240 (let ((fin (save-excursion (forward-paragraph) (point))) 240 ;; Find end of paragraph, and compute the smallest fill-prefix
241 (start (point))) 241 ;; that fits all the lines in this paragraph.
242 (fill-region-as-paragraph (point) fin justifyp) 242 (while (progn
243 (goto-char start) 243 ;; Update the fill-prefix on the first line
244 (forward-paragraph))))))) 244 ;; and whenever the prefix good so far is too long.
245 245 (if (not (and fill-prefix
246 246 (looking-at fill-prefix-regexp)))
247 (setq fill-prefix
248 (buffer-substring (point)
249 (save-excursion (skip-chars-forward " \t") (point)))
250 fill-prefix-regexp
251 (regexp-quote fill-prefix)))
252 (forward-line 1)
253 ;; Now stop the loop if end of paragraph.
254 (and (not (eobp))
255 (not (looking-at paragraph-separate))
256 (save-excursion
257 (not (and (looking-at fill-prefix-regexp)
258 (progn (forward-char (length fill-prefix))
259 (looking-at paragraph-separate))))))))
260 ;; Fill this paragraph, but don't add a newline at the end.
261 (let ((had-newline (bolp)))
262 (fill-region-as-paragraph start (point) justifyp)
263 (or had-newline (delete-char -1)))))))) \ No newline at end of file