*** empty log message ***
This commit is contained in:
parent
0231f2dce8
commit
aa228418e9
12 changed files with 351 additions and 230 deletions
88
lisp/diff.el
88
lisp/diff.el
|
@ -29,12 +29,22 @@
|
|||
;; containing 0 or more arguments which are passed on to `diff'.
|
||||
;; NOTE: This is not an ordinary hook; it may not be a list of functions.")
|
||||
|
||||
;; - fpb@ittc.wec.com - Sep 25, 1990
|
||||
;; Added code to support sccs diffing.
|
||||
;; also fixed one minor glitch in the
|
||||
;; search for the pattern. If you only 1 addition you won't find the end
|
||||
;; of the pattern (minor)
|
||||
|
||||
;;
|
||||
(defvar diff-switches nil
|
||||
"*A list of switches to pass to the diff program.")
|
||||
|
||||
(defvar diff-search-pattern "^\\([0-9]\\|\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\)"
|
||||
"Regular expression that delineates difference regions in diffs.")
|
||||
|
||||
(defvar diff-rcs-extension ",v"
|
||||
"*Extension to find RCS file, some systems do not use ,v")
|
||||
|
||||
;; Initialize the keymap if it isn't already
|
||||
(if (boundp 'diff-mode-map)
|
||||
nil
|
||||
|
@ -75,22 +85,78 @@ and what appears to be it's backup for OLD."
|
|||
(message "Comparing files %s %s..." new old)
|
||||
(setq new (expand-file-name new)
|
||||
old (expand-file-name old))
|
||||
(let ((buffer-read-only nil)
|
||||
(sw diff-switches))
|
||||
(diff-internal-diff "diff" (append diff-switches (list new old)) nil))
|
||||
|
||||
(defun diff-sccs (new)
|
||||
"Find and display the differences between OLD and SCCS files."
|
||||
(interactive
|
||||
(let (newf)
|
||||
(list
|
||||
(setq newf (buffer-file-name)
|
||||
newf (if (and newf (file-exists-p newf))
|
||||
(read-file-name
|
||||
(concat "Diff new file: ("
|
||||
(file-name-nondirectory newf) ") ")
|
||||
nil newf t)
|
||||
(read-file-name "Diff new file: " nil nil t))))))
|
||||
|
||||
(message "Comparing SCCS file %s..." new)
|
||||
(setq new (expand-file-name new))
|
||||
(if (file-exists-p (concat
|
||||
(file-name-directory new)
|
||||
"SCCS/s."
|
||||
(file-name-nondirectory new)))
|
||||
(diff-internal-diff "sccs"
|
||||
(append '("diffs") diff-switches (list new))
|
||||
2)
|
||||
(error "%s does not exist"
|
||||
(concat (file-name-directory new) "SCCS/s."
|
||||
(file-name-nondirectory new)))))
|
||||
|
||||
(defun diff-rcs (new)
|
||||
"Find and display the differences between OLD and RCS files."
|
||||
(interactive
|
||||
(let (newf)
|
||||
(list
|
||||
(setq newf (buffer-file-name)
|
||||
newf (if (and newf (file-exists-p newf))
|
||||
(read-file-name
|
||||
(concat "Diff new file: ("
|
||||
(file-name-nondirectory newf) ") ")
|
||||
nil newf t)
|
||||
(read-file-name "Diff new file: " nil nil t))))))
|
||||
|
||||
(message "Comparing RCS file %s..." new)
|
||||
(let* ((fullname (expand-file-name new))
|
||||
(rcsfile (concat (file-name-directory fullname)
|
||||
"RCS/"
|
||||
(file-name-nondirectory fullname)
|
||||
diff-rcs-extension)))
|
||||
(if (file-exists-p rcsfile)
|
||||
(diff-internal-diff "rcsdiff" (append diff-switches (list fullname)) 4)
|
||||
(error "%s does not exist" rcsfile))))
|
||||
|
||||
(defun diff-internal-diff (diff-command sw strip)
|
||||
(let ((buffer-read-only nil))
|
||||
(with-output-to-temp-buffer "*Diff Output*"
|
||||
(buffer-disable-undo standard-output)
|
||||
(save-excursion
|
||||
(set-buffer standard-output)
|
||||
(erase-buffer)
|
||||
(apply 'call-process "diff" nil t nil
|
||||
(append diff-switches (list old new)))))
|
||||
(apply 'call-process diff-command nil t nil sw)))
|
||||
(set-buffer "*Diff Output*")
|
||||
(goto-char (point-min))
|
||||
(while sw
|
||||
(if (string= (car sw) "-c")
|
||||
;; strip leading filenames from context diffs
|
||||
(progn (forward-line 2) (delete-region (point-min) (point))))
|
||||
(setq sw (cdr sw))))
|
||||
(if (and (string= (car sw) "-C") (string= "sccs" diff-command))
|
||||
;; strip stuff from SCCS context diffs
|
||||
(progn (forward-line 2) (delete-region (point-min) (point))))
|
||||
(setq sw (cdr sw)))
|
||||
(if strip
|
||||
;; strip stuff from SCCS context diffs
|
||||
(progn (forward-line strip) (delete-region (point-min) (point)))))
|
||||
(diff-mode)
|
||||
(if (string= "0" diff-total-differences)
|
||||
(let ((buffer-read-only nil))
|
||||
|
@ -103,7 +169,7 @@ and what appears to be it's backup for OLD."
|
|||
(goto-char (point-max)))))
|
||||
(setq diff-current-difference "1")))
|
||||
|
||||
;; Take a buffer full of Unix diff output and go into a mode to easily
|
||||
;; Take a buffer full of Unix diff output and go into a mode to easily
|
||||
;; see the next and previous difference
|
||||
(defun diff-mode ()
|
||||
"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:
|
|||
(int-to-string (diff-count-differences))))
|
||||
|
||||
(defun diff-next-difference (n)
|
||||
"In diff mode, go to the beginning of the next difference as delimited
|
||||
by `diff-search-pattern'."
|
||||
"Go to the beginning of the next difference.
|
||||
Differences are delimited by `diff-search-pattern'."
|
||||
(interactive "p")
|
||||
(if (< n 0) (diff-previous-difference (- n))
|
||||
(if (zerop n) ()
|
||||
|
@ -153,8 +219,8 @@ by `diff-search-pattern'."
|
|||
(goto-char (point-min)))))
|
||||
|
||||
(defun diff-previous-difference (n)
|
||||
"In diff mode, go the the beginning of the previous difference as delimited
|
||||
by `diff-search-pattern'."
|
||||
"Go the the beginning of the previous difference.
|
||||
Differences are delimited by `diff-search-pattern'."
|
||||
(interactive "p")
|
||||
(if (< n 0) (diff-next-difference (- n))
|
||||
(if (zerop n) ()
|
||||
|
@ -172,7 +238,7 @@ by `diff-search-pattern'."
|
|||
(goto-char (point-min)))))
|
||||
|
||||
(defun diff-show-difference (n)
|
||||
"Show difference number N (prefix arg)."
|
||||
"Show difference number N (prefix argument)."
|
||||
(interactive "p")
|
||||
(let ((cur (string-to-int diff-current-difference)))
|
||||
(cond ((or (= n cur)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
;;; find-dired.el -- Run a `find' command and dired the result.
|
||||
;;; find-dired.el -- Run a `find' command and dired the output
|
||||
;;; Copyright (C) 1991 Roland McGrath
|
||||
|
||||
(defconst find-dired-version "$Id: find-dired.el,v 1.7 1991/06/20 08:50:20 sk RelBeta $")
|
||||
(defconst find-dired-version (substring "$Revision: 1.9 $" 11 -2)
|
||||
"$Id: find-dired.el,v 1.9 1991/11/11 13:24:31 sk Exp $")
|
||||
|
||||
;;; 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
|
||||
|
@ -18,43 +19,67 @@
|
|||
;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
|
||||
;;; 02139, USA.
|
||||
;;;
|
||||
;;; Send bug reports to roland@gnu.ai.mit.edu.
|
||||
;; LISPDIR ENTRY for the Elisp Archive ===============================
|
||||
;; LCD Archive Entry:
|
||||
;; find-dired|Roland McGrath, Sebastian Kremer
|
||||
;; |roland@gnu.ai.mit.edu, sk@thp.uni-koeln.de
|
||||
;; |Run a `find' command and dired the output
|
||||
;; |$Date: 1991/11/11 13:24:31 $|$Revision: 1.9 $|
|
||||
|
||||
;;; To use this file, byte-compile it, install it somewhere
|
||||
;;; in your load-path, and put:
|
||||
;;; (autoload 'find-dired "find-dired" nil t)
|
||||
;;; (autoload 'lookfor-dired "find-dired" nil t)
|
||||
;;; in your .emacs, or site-init.el, etc.
|
||||
;;; To bind it to a key, put, e.g.:
|
||||
;;; (global-set-key "\C-cf" 'find-dired)
|
||||
;;; (global-set-key "\C-cl" 'lookfor-dired)
|
||||
;;; in your .emacs.
|
||||
;; INSTALLATION ======================================================
|
||||
|
||||
;; To use this file, byte-compile it, install it somewhere in your
|
||||
;; load-path, and put:
|
||||
|
||||
;; (autoload 'find-dired "find-dired" nil t)
|
||||
;; (autoload 'find-name-dired "find-dired" nil t)
|
||||
;; (autoload 'find-grep-dired "find-dired" nil t)
|
||||
|
||||
;; in your ~/.emacs, or site-init.el, etc.
|
||||
|
||||
;; To bind it to a key, put, e.g.:
|
||||
;;
|
||||
;; (global-set-key "\C-cf" 'find-dired)
|
||||
;; (global-set-key "\C-cn" 'find-name-dired)
|
||||
;; (global-set-key "\C-cl" 'find-grep-dired)
|
||||
;;
|
||||
;; in your ~/.emacs.
|
||||
|
||||
(require 'dired)
|
||||
(provide 'find-dired)
|
||||
|
||||
;;;###autoload
|
||||
(defvar find-ls-option (if (eq system-type 'berkeley-unix) "-ls"
|
||||
"-exec ls -ldi {} \\;")
|
||||
"*Option to `find' to produce an `ls -l'-type listing.")
|
||||
|
||||
;;;###autoload
|
||||
(defvar find-grep-options (if (eq system-type 'berkeley-unix) "-s" "-l")
|
||||
"*Option to grep to be as silent as possible.
|
||||
On Berkeley systems, this is `-s', for others it seems impossible to
|
||||
suppress all output, so `-l' is used to print nothing more than the
|
||||
file name.")
|
||||
|
||||
(defvar find-args nil
|
||||
"Last arguments given to `find' by \\[find-dired].")
|
||||
|
||||
(defvar find-ls-option (if (eq system-type 'berkeley-unix) "-ls"
|
||||
"-exec ls -ldi {} \\;")
|
||||
"Option to `find' to produce an `ls -l'-type listing.")
|
||||
|
||||
;;;###autoload
|
||||
(defun find-dired (dir args)
|
||||
"Run `find' and go into dired-mode on a buffer of the output.
|
||||
The command run is \"find . \\( ARGS \\) -ls\" (after changing into DIR)."
|
||||
The command run (after changing into DIR) is
|
||||
|
||||
find . \\( ARGS \\) -ls"
|
||||
(interactive (list (read-file-name "Run find in directory: " nil "" t)
|
||||
(if (featurep 'gmhist)
|
||||
(read-with-history-in 'find-args-history
|
||||
"Run find (with args): ")
|
||||
(read-string "Run find (with args): " find-args))))
|
||||
(if (equal dir "")
|
||||
(setq dir default-directory))
|
||||
;; Expand DIR, and make sure it has a trailing slash.
|
||||
;; Expand DIR ("" means default-directory), and make sure it has a
|
||||
;; trailing slash.
|
||||
(setq dir (file-name-as-directory (expand-file-name dir)))
|
||||
;; Check that it's really a directory.
|
||||
(or (file-directory-p dir)
|
||||
(error "%s is not a directory!" dir))
|
||||
(error "find-dired needs a directory: %s" dir))
|
||||
(switch-to-buffer (get-buffer-create "*Find*"))
|
||||
(widen)
|
||||
(kill-all-local-variables)
|
||||
|
@ -64,25 +89,63 @@ The command run is \"find . \\( ARGS \\) -ls\" (after changing into DIR)."
|
|||
find-args args
|
||||
args (concat "find . " (if (string= args "") ""
|
||||
(concat "\\( " args " \\) ")) find-ls-option))
|
||||
(insert " " args "\n"
|
||||
" " dir ":\n")
|
||||
(dired-mode dir "-gils");; find(1)'s -ls corresponds to `ls -gilds'
|
||||
;; (but we don't want -d, of course)
|
||||
;; Set subdir-alist so that Tree Dired will work (but STILL NOT with
|
||||
;; dired-nstd.el):
|
||||
(set (make-local-variable 'dired-subdir-alist)
|
||||
(list (cons default-directory (point-marker)))) ; we are at point-min
|
||||
(setq buffer-read-only nil)
|
||||
;; Subdir headlerline must come first because the first marker in
|
||||
;; subdir-alist points there.
|
||||
(insert " " dir ":\n")
|
||||
;; Make second line a ``find'' line in analogy to the ``total'' or
|
||||
;; ``wildcard'' line.
|
||||
(insert " " args "\n")
|
||||
;; Start the find process
|
||||
(set-process-filter (start-process-shell-command "find"
|
||||
(current-buffer) args)
|
||||
'find-dired-filter)
|
||||
(function find-dired-filter))
|
||||
(set-process-sentinel (get-buffer-process (current-buffer))
|
||||
'find-dired-sentinel)
|
||||
(dired-mode)
|
||||
(function find-dired-sentinel))
|
||||
(setq mode-line-process '(": %s")))
|
||||
|
||||
;;;###autoload
|
||||
(defun find-name-dired (dir pattern)
|
||||
"Search DIR recursively for files matching the globbing pattern PATTERN,
|
||||
and run dired on those files."
|
||||
(interactive "DSearch directory: \nsSearch directory %s for: ")
|
||||
and run dired on those files.
|
||||
PATTERN is a shell wildcard (not an Emacs regexp) and need not be quoted.
|
||||
The command run (after changing into DIR) is
|
||||
|
||||
find . -name 'PATTERN' -ls"
|
||||
(interactive
|
||||
"DFind-name (directory): \nsFind-name (filename wildcard): ")
|
||||
(find-dired dir (concat "-name '" pattern "'")))
|
||||
|
||||
;; This functionality suggested by
|
||||
;; From: oblanc@watcgl.waterloo.edu (Olivier Blanc)
|
||||
;; Subject: find-dired, lookfor-dired
|
||||
;; Date: 10 May 91 17:50:00 GMT
|
||||
;; Organization: University of Waterloo
|
||||
|
||||
(fset 'lookfor-dired 'find-grep-dired)
|
||||
;;;###autoload
|
||||
(defun find-grep-dired (dir args)
|
||||
"Find files in DIR containing a regexp ARG and start Dired on output.
|
||||
The command run (after changing into DIR) is
|
||||
|
||||
find . -exec grep -s ARG {} \\\; -ls
|
||||
|
||||
Thus ARG can also contain additional grep options."
|
||||
(interactive "DFind-grep (directory): \nsFind-grep (grep args): ")
|
||||
;; find -exec doesn't allow shell i/o redirections in the command,
|
||||
;; or we could use `grep -l >/dev/null'
|
||||
(find-dired dir
|
||||
(concat "-exec grep " find-grep-options " " args " {} \\\; ")))
|
||||
|
||||
(defun find-dired-filter (proc string)
|
||||
;; Filter for \\[find-dired] processes.
|
||||
(dired-log "``%s''\n" string)
|
||||
(let ((buf (process-buffer proc)))
|
||||
(if (buffer-name buf) ; not killed?
|
||||
(save-excursion
|
||||
|
@ -99,7 +162,13 @@ and run dired on those files."
|
|||
(forward-line 1))
|
||||
(while (looking-at "^")
|
||||
(insert " ")
|
||||
(forward-line 1))))))
|
||||
(forward-line 1))
|
||||
;; Convert ` ./FILE' to ` FILE'
|
||||
;; This would lose if the current chunk of output
|
||||
;; starts or ends within the ` ./', so backup up a bit:
|
||||
(goto-char (- end 3)) ; no error if < 0
|
||||
(while (search-forward " ./" nil t)
|
||||
(delete-region (point) (- (point) 2)))))))
|
||||
;; The buffer has been killed.
|
||||
(delete-process proc))))
|
||||
|
||||
|
@ -129,51 +198,5 @@ Wildcards and redirection are handle as usual in the shell."
|
|||
(if (eq system-type 'vax-vms)
|
||||
(apply 'start-process name buffer args)
|
||||
(start-process name buffer shell-file-name "-c"
|
||||
(concat "exec " (mapconcat 'identity args " ")))))
|
||||
)
|
||||
(concat "exec " (mapconcat 'identity args " "))))))
|
||||
|
||||
;; From: oblanc@watcgl.waterloo.edu (Olivier Blanc)
|
||||
;; Subject: find-dired, lookfor-dired
|
||||
;; Date: 10 May 91 17:50:00 GMT
|
||||
;; Organization: University of Waterloo
|
||||
|
||||
;; I added a functiopn to the find-dired.el file:
|
||||
;; The function is a lookfor-dired and is used to search a string
|
||||
;; a subtree:
|
||||
|
||||
;;;###autoload
|
||||
(defun lookfor-dired (dir args)
|
||||
"Find files in DIR containing a regexp ARG and go into dired-mode on the output.
|
||||
The command run is
|
||||
|
||||
\"find . -exec grep -l ARG {} \\\; -ls\"
|
||||
|
||||
\(after changing into DIR)."
|
||||
(interactive (list (read-file-name "Run find in directory: " nil "" t)
|
||||
(read-string "Run find (with args): " find-args)))
|
||||
(if (equal dir "")
|
||||
(setq dir default-directory))
|
||||
;; Expand DIR, and make sure it has a trailing slash.
|
||||
(setq dir (file-name-as-directory (expand-file-name dir)))
|
||||
;; Check that it's really a directory.
|
||||
(or (file-directory-p dir)
|
||||
(error "%s is not a directory!" dir))
|
||||
(switch-to-buffer (get-buffer-create "*Find*"))
|
||||
(widen)
|
||||
(kill-all-local-variables)
|
||||
(setq buffer-read-only nil)
|
||||
(erase-buffer)
|
||||
(setq default-directory dir
|
||||
find-args args
|
||||
args (concat "find . -exec grep -l " args " {} \\\; -ls"))
|
||||
(insert " " args "\n"
|
||||
" " dir ":\n")
|
||||
(set-process-filter (start-process-shell-command "find"
|
||||
(current-buffer) args)
|
||||
'find-dired-filter)
|
||||
(set-process-sentinel (get-buffer-process (current-buffer))
|
||||
'find-dired-sentinel)
|
||||
(dired-mode)
|
||||
(setq mode-line-process '(": %s")))
|
||||
|
||||
(provide 'find-dired)
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
(defvar bug-gnu-emacs "bug-gnu-emacs@prep.ai.mit.edu"
|
||||
"Address of site maintaining mailing list for GNU Emacs bugs.")
|
||||
|
||||
;;;###autoload
|
||||
(defun report-emacs-bug (topic)
|
||||
"Report a bug in Gnu emacs.
|
||||
"Report a bug in GNU Emacs.
|
||||
Prompts for bug subject. Leaves you in a mail buffer."
|
||||
(interactive "sBug Subject: ")
|
||||
(mail nil bug-gnu-emacs topic)
|
||||
|
|
|
@ -120,11 +120,12 @@
|
|||
|
||||
;; originally defined in sendmail.el - used to be an alist, now is a table.
|
||||
(defvar mail-aliases nil
|
||||
"Word-abbrev table of mail address aliases.
|
||||
"Abbrev table of mail address aliases.
|
||||
If this is nil, it means the aliases have not yet been initialized and
|
||||
should be read from the .mailrc file. (This is distinct from there being
|
||||
no aliases, which is represented by this being a table with no entries.)")
|
||||
|
||||
;;;###autoload
|
||||
(defun mail-aliases-setup ()
|
||||
(if (and (not (vectorp mail-aliases))
|
||||
(file-exists-p (mail-abbrev-mailrc-file)))
|
||||
|
@ -217,6 +218,7 @@ also want something like \",\\n \" to get each address on its own line.")
|
|||
;; originally defined in mailalias.el ; build-mail-aliases calls this with
|
||||
;; stuff parsed from the .mailrc file.
|
||||
;;
|
||||
;;;###autoload
|
||||
(defun define-mail-alias (name definition &optional from-mailrc-file)
|
||||
"Define NAME as a mail-alias that translates to DEFINITION.
|
||||
If DEFINITION contains multiple addresses, seperate them with commas."
|
||||
|
@ -295,10 +297,9 @@ If DEFINITION contains multiple addresses, seperate them with commas."
|
|||
|
||||
|
||||
(defun mail-abbrev-expand-hook ()
|
||||
"For use as the fourth arg to define-abbrev.
|
||||
After expanding a mail-abbrev, if fill-mode is on and we're past the
|
||||
fill-column, break the line at the previous comma, and indent the next
|
||||
line."
|
||||
"For use as the fourth arg to `define-abbrev'.
|
||||
After expanding a mail alias, if Auto Fill mode is on and we're past the
|
||||
fill column, break the line at the previous comma, and indent the next line."
|
||||
(save-excursion
|
||||
(let ((p (point))
|
||||
bol)
|
||||
|
@ -337,7 +338,7 @@ This should be set to match those mail fields in which you want abbreviations
|
|||
turned on.")
|
||||
|
||||
(defvar mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table)
|
||||
"The syntax table which is current in send-mail mode.")
|
||||
"The syntax table which is current in mail mode.")
|
||||
|
||||
(defvar mail-mode-header-syntax-table
|
||||
(let ((tab (copy-syntax-table text-mode-syntax-table)))
|
||||
|
@ -362,7 +363,9 @@ turned on.")
|
|||
"The syntax table used when the cursor is in a mail-address header.
|
||||
mail-mode-syntax-table is used when the cursor is not in an address header.")
|
||||
|
||||
|
||||
;; This hook is run before trying to expand an abbrev in a mail buffer.
|
||||
;; It determines whether point is in the header, and chooses which
|
||||
;; abbrev table accordingly.
|
||||
(defun sendmail-pre-abbrev-expand-hook ()
|
||||
(if mail-abbrev-aliases-need-to-be-resolved
|
||||
(mail-resolve-all-aliases))
|
||||
|
@ -425,17 +428,5 @@ mail-mode-syntax-table is used when the cursor is not in an address header.")
|
|||
(setq mail-aliases nil)
|
||||
(build-mail-aliases file))
|
||||
|
||||
|
||||
;;; Patching it in:
|
||||
;;; Remove the entire file mailalias.el
|
||||
;;; Remove the definition of mail-aliases from sendmail.el
|
||||
;;; Add a call to mail-aliases-setup to mail-setup in sendmail.el
|
||||
;;; Remove the call to expand-mail-aliases from sendmail-send-it in sendmail.el
|
||||
;;; Remove the autoload of expand-mail-aliases from sendmail.el
|
||||
;;; Remove the autoload of build-mail-aliases from sendmail.el
|
||||
;;; Add an autoload of define-mail-alias
|
||||
|
||||
(fmakunbound 'expand-mail-aliases)
|
||||
|
||||
(provide 'mail-abbrevs)
|
||||
|
||||
|
|
|
@ -142,17 +142,27 @@ DEFINITION can be one or more mail addresses separated by commas."
|
|||
(setq mail-aliases nil)
|
||||
(if (file-exists-p "~/.mailrc")
|
||||
(build-mail-aliases))))
|
||||
(let (tem)
|
||||
;; ~/.mailrc contains addresses separated by spaces.
|
||||
;; mailers should expect addresses separated by commas.
|
||||
(while (setq tem (string-match "[^ \t,][ \t,]+" definition tem))
|
||||
(if (= (match-end 0) (length definition))
|
||||
(setq definition (substring definition 0 (1+ tem)))
|
||||
(setq definition (concat (substring definition
|
||||
0 (1+ tem))
|
||||
", "
|
||||
(substring definition (match-end 0))))
|
||||
(setq tem (+ 3 tem))))
|
||||
;; Strip leading and trailing blanks.
|
||||
(if (string-match "^[ \t]+" definition)
|
||||
(setq definition (substring definition (match-end 0))))
|
||||
(if (string-match "[ \t]+$" definition)
|
||||
(setq definition (substring definition 0 (match-beginning 0))))
|
||||
(let ((first (aref definition 0))
|
||||
(last (aref definition (1- (length definition))))
|
||||
tem)
|
||||
(if (and (= first last) (memq first '(?\' ?\")))
|
||||
;; Strip quotation marks.
|
||||
(setq definition (substring definition 1 (1- (length definition))))
|
||||
;; ~/.mailrc contains addresses separated by spaces.
|
||||
;; mailers should expect addresses separated by commas.
|
||||
(while (setq tem (string-match "[^ \t,][ \t,]+" definition tem))
|
||||
(if (= (match-end 0) (length definition))
|
||||
(setq definition (substring definition 0 (1+ tem)))
|
||||
(setq definition (concat (substring definition
|
||||
0 (1+ tem))
|
||||
", "
|
||||
(substring definition (match-end 0))))
|
||||
(setq tem (+ 3 tem)))))
|
||||
(setq tem (assoc name mail-aliases))
|
||||
(if tem
|
||||
(rplacd tem definition)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;; "RMAIL" mail reader for Emacs.
|
||||
;; Copyright (C) 1985, 1986, 1987, 1988 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1985, 1986, 1987, 1988, 1991 Free Software Foundation, Inc.
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
|
@ -638,7 +638,7 @@ argument causes us to read a file name and use that file as the inbox."
|
|||
(concat "^[\^_]?\\("
|
||||
"From [^ \n]*\\(\\|\".*\"[^ \n]*\\) ?[^ \n]* [^ \n]* *"
|
||||
"[0-9]* [0-9:]*\\( ?[A-Z]?[A-Z][A-Z]T\\| ?[-+]?[0-9][0-9][0-9][0-9]\\|\\) " ; EDT, -0500
|
||||
"19[0-9]* *\\(remote from [^\n]*\\)?$\\|"
|
||||
"[0-9]+ *\\(remote from [^\n]*\\)?$\\|"
|
||||
mmdf-delim1 "\\|"
|
||||
"^BABYL OPTIONS:\\|"
|
||||
"\^L\n[01],\\)") nil t)
|
||||
|
@ -684,7 +684,7 @@ argument causes us to read a file name and use that file as the inbox."
|
|||
(goto-char start))
|
||||
(let ((case-fold-search nil))
|
||||
(if (re-search-forward
|
||||
"^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)
|
||||
"^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)
|
||||
(replace-match
|
||||
(concat
|
||||
"Mail-from: \\&"
|
||||
|
|
|
@ -50,11 +50,6 @@ The headers are be delimited by a line which is mail-header-separator.")
|
|||
*Name of file to write all outgoing messages in, or nil for none.
|
||||
Do not use an rmail file here! Instead, use its inbox file.")
|
||||
|
||||
;;;###autoload
|
||||
(defvar mail-aliases t "\
|
||||
Alias of mail address aliases,
|
||||
or t meaning should be initialized from .mailrc.")
|
||||
|
||||
(defvar mail-default-reply-to nil
|
||||
"*Address to insert as default Reply-to field of outgoing messages.")
|
||||
|
||||
|
@ -92,22 +87,9 @@ so you can edit or delete these lines.")
|
|||
(setq mail-mode-syntax-table (copy-syntax-table text-mode-syntax-table))
|
||||
(modify-syntax-entry ?% ". " mail-mode-syntax-table)))
|
||||
|
||||
(autoload 'build-mail-aliases "mailalias"
|
||||
"Read mail aliases from ~/.mailrc and set mail-aliases."
|
||||
nil)
|
||||
|
||||
(autoload 'expand-mail-aliases "mailalias"
|
||||
"Expand all mail aliases in suitable header fields found between BEG and END.
|
||||
Suitable header fields are To, CC and BCC."
|
||||
nil)
|
||||
|
||||
(defun mail-setup (to subject in-reply-to cc replybuffer actions)
|
||||
(setq mail-send-actions actions)
|
||||
(if (eq mail-aliases t)
|
||||
(progn
|
||||
(setq mail-aliases nil)
|
||||
(if (file-exists-p "~/.mailrc")
|
||||
(build-mail-aliases))))
|
||||
(mail-aliases-setup)
|
||||
(setq mail-reply-buffer replybuffer)
|
||||
(goto-char (point-min))
|
||||
(insert "To: ")
|
||||
|
@ -258,8 +240,6 @@ the user from the mailer."
|
|||
(replace-match "\n")
|
||||
(backward-char 1)
|
||||
(setq delimline (point-marker))
|
||||
(if mail-aliases
|
||||
(expand-mail-aliases (point-min) delimline))
|
||||
(goto-char (point-min))
|
||||
;; ignore any blank lines in the header
|
||||
(while (and (re-search-forward "\n\n\n*" delimline t)
|
||||
|
|
10
lisp/man.el
10
lisp/man.el
|
@ -136,6 +136,16 @@ where SECTION is the desired section of the manual, as in \"tty(4)\"."
|
|||
(while (re-search-forward "\e[789]" nil t)
|
||||
(replace-match ""))
|
||||
|
||||
;; Convert o^H+ into o.
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "o\010\\+" nil t)
|
||||
(replace-match "o"))
|
||||
|
||||
;; Nuke the dumb reformatting message
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "Reformatting page. Wait... done\n\n" nil t)
|
||||
(replace-match ""))
|
||||
|
||||
;; Crunch blank lines
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\n\n\n\n*" nil t)
|
||||
|
|
|
@ -63,27 +63,27 @@ ESC or q to exit (skip all following objects); . (period) to act on the
|
|||
current object and then exit; or \\[help-command] to get help.
|
||||
|
||||
Returns the number of actions taken."
|
||||
(let ((old-help-form help-form)
|
||||
(help-form (cons 'map-y-or-n-p-help
|
||||
(or help '("object" "objects" "act on"))))
|
||||
(actions 0)
|
||||
prompt
|
||||
char
|
||||
elt
|
||||
(next (if (or (symbolp list)
|
||||
(subrp list)
|
||||
(compiled-function-p list)
|
||||
(and (consp list)
|
||||
(eq (car list) 'lambda)))
|
||||
(function (lambda ()
|
||||
(setq elt (funcall list))))
|
||||
(function (lambda ()
|
||||
(if list
|
||||
(progn
|
||||
(setq elt (car list)
|
||||
list (cdr list))
|
||||
t)
|
||||
nil))))))
|
||||
(let* ((old-help-form help-form)
|
||||
(help-form (cons 'map-y-or-n-p-help
|
||||
(or help '("object" "objects" "act on"))))
|
||||
(actions 0)
|
||||
prompt
|
||||
char
|
||||
elt
|
||||
(next (if (or (symbolp list)
|
||||
(subrp list)
|
||||
(compiled-function-p list)
|
||||
(and (consp list)
|
||||
(eq (car list) 'lambda)))
|
||||
(function (lambda ()
|
||||
(setq elt (funcall list))))
|
||||
(function (lambda ()
|
||||
(if list
|
||||
(progn
|
||||
(setq elt (car list)
|
||||
list (cdr list))
|
||||
t)
|
||||
nil))))))
|
||||
(if (stringp prompter)
|
||||
(setq prompter (` (lambda (object)
|
||||
(format (, prompter) object)))))
|
||||
|
@ -122,7 +122,7 @@ Returns the number of actions taken."
|
|||
(progn
|
||||
(funcall actor elt)
|
||||
(setq actions (1+ actions))))
|
||||
(while (setq elt (funcall next))
|
||||
(while (funcall next)
|
||||
(if (eval (funcall prompter elt))
|
||||
(progn
|
||||
(funcall actor elt)
|
||||
|
|
|
@ -45,15 +45,17 @@ It should read in the source files which have errors and set
|
|||
`compilation-error-list' to a list with an element for each error message
|
||||
found. See that variable for more info.")
|
||||
|
||||
;;;###autoload
|
||||
(defvar compilation-buffer-name-function nil
|
||||
"Function to call with one argument, the name of the major mode of the
|
||||
"*Function to call with one argument, the name of the major mode of the
|
||||
compilation buffer, to give the buffer a name. It should return a string.
|
||||
If nil, the name \"*compilation*\" is used for compilation buffers,
|
||||
and the name \"*grep*\" is used for grep buffers.
|
||||
\(Actually, the name (concat "*" (downcase major-mode) "*") is used.)")
|
||||
\(Actually, the name (concat \"*\" (downcase major-mode) \"*\") is used.)")
|
||||
|
||||
;;;###autoload
|
||||
(defvar compilation-finish-function nil
|
||||
"Function to call when a compilation process finishes.
|
||||
"*Function to call when a compilation process finishes.
|
||||
It is called with two arguments: the compilation buffer, and a string
|
||||
describing how the process finished.")
|
||||
|
||||
|
@ -279,8 +281,9 @@ means the default). The defaults for these variables are the global values of
|
|||
(window-height))))
|
||||
(select-window w))))
|
||||
;; Start the compilation.
|
||||
(start-process-shell-command (downcase mode-name) outbuf command)
|
||||
(set-process-sentinel (get-buffer-process outbuf)
|
||||
(set-process-sentinel (start-process-shell-command (downcase mode-name)
|
||||
outbuf
|
||||
command)
|
||||
'compilation-sentinel))
|
||||
;; Make it so the next C-x ` will use this buffer.
|
||||
(setq compilation-last-buffer outbuf)))
|
||||
|
|
|
@ -136,49 +136,67 @@ File names returned are absolute."
|
|||
default
|
||||
spec))))
|
||||
|
||||
(defun tags-tag-match (tagname exact)
|
||||
"Search for a match to the given tagname."
|
||||
(if (not exact)
|
||||
(search-forward tagname nil t)
|
||||
(not (error-occurred
|
||||
(while
|
||||
(progn
|
||||
(search-forward tagname)
|
||||
(let ((before (char-syntax (char-after (1- (match-beginning 1)))))
|
||||
(after (char-syntax (char-after (match-end 1)))))
|
||||
(not (or (= before ?w) (= before ?_))
|
||||
(= after ?w) (= after ?_)))
|
||||
))))
|
||||
)
|
||||
)
|
||||
|
||||
(defun find-tag-noselect (tagname exact &optional next)
|
||||
"Find a tag and return its buffer, but don't select or display it."
|
||||
(let (buffer file linebeg startpos)
|
||||
(save-excursion
|
||||
(visit-tags-table-buffer)
|
||||
(if (not next)
|
||||
(goto-char (point-min))
|
||||
(setq tagname last-tag))
|
||||
(setq last-tag tagname)
|
||||
(while (progn
|
||||
(if (not (if exact
|
||||
(re-search-forward (concat "\\W" tagname "\\W") nil t)
|
||||
(search-forward tagname nil t)))
|
||||
(error "No %sentries containing %s"
|
||||
(if next "more " "") tagname))
|
||||
(not (looking-at "[^\n\177]*\177"))))
|
||||
(search-forward "\177")
|
||||
(setq file (expand-file-name (file-of-tag)
|
||||
(file-name-directory tags-file-name)))
|
||||
(setq linebeg
|
||||
(buffer-substring (1- (point))
|
||||
(save-excursion (beginning-of-line) (point))))
|
||||
(search-forward ",")
|
||||
(setq startpos (read (current-buffer)))
|
||||
(prog1
|
||||
(set-buffer (find-file-noselect file))
|
||||
(widen)
|
||||
(push-mark)
|
||||
(let ((offset 1000)
|
||||
found
|
||||
(pat (concat "^" (regexp-quote linebeg))))
|
||||
(or startpos (setq startpos (point-min)))
|
||||
(while (and (not found)
|
||||
(progn
|
||||
(goto-char (- startpos offset))
|
||||
(not (bobp))))
|
||||
(setq found
|
||||
(re-search-forward pat (startpos offset) t))
|
||||
(setq offset (* 3 offset)))
|
||||
(or found
|
||||
(re-search-forward pat nil t)
|
||||
(error "%s not found in %s" pat file)))
|
||||
(beginning-of-line)))
|
||||
(let (buffer file linebeg startpos (obuf (current-buffer)))
|
||||
;; save-excursion will do the wrong thing if the buffer containing the
|
||||
;; tag being searched for is current-buffer
|
||||
(unwind-protect
|
||||
(progn
|
||||
(visit-tags-table-buffer)
|
||||
(if (not next)
|
||||
(goto-char (point-min))
|
||||
(setq tagname last-tag))
|
||||
(setq last-tag tagname)
|
||||
(while (progn
|
||||
(if (not (tags-tag-match tagname exact))
|
||||
(error "No %sentries matching %s"
|
||||
(if next "more " "") tagname))
|
||||
(not (looking-at "[^\n\177]*\177"))))
|
||||
(search-forward "\177")
|
||||
(setq file (expand-file-name (file-of-tag)
|
||||
(file-name-directory tags-file-name)))
|
||||
(setq linebeg
|
||||
(buffer-substring (1- (point))
|
||||
(save-excursion (beginning-of-line) (point))))
|
||||
(search-forward ",")
|
||||
(setq startpos (read (current-buffer)))
|
||||
(prog1
|
||||
(set-buffer (find-file-noselect file))
|
||||
(widen)
|
||||
(push-mark)
|
||||
(let ((offset 1000)
|
||||
found
|
||||
(pat (concat "^" (regexp-quote linebeg))))
|
||||
(or startpos (setq startpos (point-min)))
|
||||
(while (and (not found)
|
||||
(progn
|
||||
(goto-char (- startpos offset))
|
||||
(not (bobp))))
|
||||
(setq found
|
||||
(re-search-forward pat (+ startpos offset) t))
|
||||
(setq offset (* 3 offset)))
|
||||
(or found
|
||||
(re-search-forward pat nil t)
|
||||
(error "%s not found in %s" pat file)))
|
||||
(beginning-of-line)))
|
||||
(set-buffer obuf))
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -334,3 +352,5 @@ unless it has one in the tag table."
|
|||
(point))))
|
||||
(terpri)
|
||||
(forward-line 1)))))
|
||||
|
||||
;; etags.el ends here
|
||||
|
|
|
@ -224,23 +224,40 @@ Optional third and fourth arguments JUSTIFY-FLAG and MAIL-FLAG:
|
|||
JUSTIFY-FLAG to justify paragraphs (prefix arg),
|
||||
MAIL-FLAG for a mail message, i. e. don't fill header lines."
|
||||
(interactive "r\nP")
|
||||
(let (fill-prefix)
|
||||
(save-restriction
|
||||
(save-excursion
|
||||
(goto-char min)
|
||||
(if mailp
|
||||
(while (looking-at "[^ \t\n]*:")
|
||||
(forward-line 1)))
|
||||
(narrow-to-region (point) max)
|
||||
(while (progn
|
||||
(skip-chars-forward " \t\n")
|
||||
(not (eobp)))
|
||||
(setq fill-prefix
|
||||
(buffer-substring (point) (progn (beginning-of-line) (point))))
|
||||
(let ((fin (save-excursion (forward-paragraph) (point)))
|
||||
(start (point)))
|
||||
(fill-region-as-paragraph (point) fin justifyp)
|
||||
(goto-char start)
|
||||
(forward-paragraph)))))))
|
||||
|
||||
|
||||
(save-restriction
|
||||
(save-excursion
|
||||
(goto-char min)
|
||||
(beginning-of-line)
|
||||
(if mailp
|
||||
(while (looking-at "[^ \t\n]*:")
|
||||
(forward-line 1)))
|
||||
(narrow-to-region (point) max)
|
||||
;; Loop over paragraphs.
|
||||
(while (progn (skip-chars-forward " \t\n") (not (eobp)))
|
||||
(beginning-of-line)
|
||||
(let ((start (point))
|
||||
fill-prefix fill-prefix-regexp)
|
||||
;; Find end of paragraph, and compute the smallest fill-prefix
|
||||
;; that fits all the lines in this paragraph.
|
||||
(while (progn
|
||||
;; Update the fill-prefix on the first line
|
||||
;; and whenever the prefix good so far is too long.
|
||||
(if (not (and fill-prefix
|
||||
(looking-at fill-prefix-regexp)))
|
||||
(setq fill-prefix
|
||||
(buffer-substring (point)
|
||||
(save-excursion (skip-chars-forward " \t") (point)))
|
||||
fill-prefix-regexp
|
||||
(regexp-quote fill-prefix)))
|
||||
(forward-line 1)
|
||||
;; Now stop the loop if end of paragraph.
|
||||
(and (not (eobp))
|
||||
(not (looking-at paragraph-separate))
|
||||
(save-excursion
|
||||
(not (and (looking-at fill-prefix-regexp)
|
||||
(progn (forward-char (length fill-prefix))
|
||||
(looking-at paragraph-separate))))))))
|
||||
;; Fill this paragraph, but don't add a newline at the end.
|
||||
(let ((had-newline (bolp)))
|
||||
(fill-region-as-paragraph start (point) justifyp)
|
||||
(or had-newline (delete-char -1))))))))
|
Loading…
Add table
Reference in a new issue