summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog75
-rw-r--r--lisp/emacs-lisp/advice.el3
-rw-r--r--lisp/emacs-lisp/cl-extra.el7
-rw-r--r--lisp/emacs-lisp/cl-lib.el7
-rw-r--r--lisp/emacs-lisp/cl-macs.el7
-rw-r--r--lisp/emacs-lisp/cl.el54
-rw-r--r--lisp/emacs-lisp/gv.el17
-rw-r--r--lisp/mail/emacsbug.el3
-rw-r--r--lisp/minibuf-eldef.el20
-rw-r--r--lisp/server.el9
-rw-r--r--lisp/term.el18
-rw-r--r--lisp/vc/diff-mode.el96
-rw-r--r--lisp/woman.el4
13 files changed, 247 insertions, 73 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fb436fa0038..2773ea1690d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,78 @@
+2012-11-10 Glenn Morris <rgm@gnu.org>
+
+ * term.el (term-default-fg-color, term-default-bg-color):
+ Make obsolete, rather than just saying "deprecated" in the doc.
+
+ * term.el (term): Rename from `term-face'.
+ (term-current-face, ansi-term-color-vector)
+ (term-default-fg-color, term-default-bg-color, term-ansi-reset):
+ Update all users.
+
+2012-11-10 Jan Djärv <jan.h.d@swipnet.se>
+
+ * server.el (server-create-window-system-frame): Handle Nextstep
+ specially (Bug#12780).
+
+2012-11-10 Glenn Morris <rgm@gnu.org>
+
+ * mail/emacsbug.el (report-emacs-bug-query-existing-bugs):
+ Unautoload, and make obsolete. (Bug#7449)
+
+2012-11-10 Chong Yidong <cyd@gnu.org>
+
+ * vc/diff-mode.el (diff-delete-trailing-whitespace): Rewrite, and
+ rename from diff-remove-trailing-whitespace (Bug#12831).
+
+2012-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * emacs-lisp/advice.el: Require `cl-lib' at run-time to fix
+ miscompilation of trace.el.
+
+2012-11-10 Glenn Morris <rgm@gnu.org>
+
+ * vc/diff-mode.el (diff-remove-trailing-whitespace): Doc fix.
+
+2012-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * emacs-lisp/gv.el (gv-define-simple-setter): Fix last change
+ (bug#12812).
+
+2012-11-10 Chong Yidong <cyd@gnu.org>
+
+ * minibuf-eldef.el (minibuffer-eldef-shorten-default): Convert to
+ a defcustom with an appropriate :set function.
+ (minibuffer-default--in-prompt-regexps): New function.
+
+2012-11-10 Glenn Morris <rgm@gnu.org>
+
+ * emacs-lisp/cl.el (define-setf-expander, defsetf)
+ (define-modify-macro): Doc fixes.
+
+ * emacs-lisp/gv.el (gv-letplace): Fix doc typo.
+ (gv-define-simple-setter): Update doc of `fix-return'.
+
+2012-11-10 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val'
+ twice when `fix-return' is set (bug#12813).
+
+ * emacs-lisp/cl.el (defsetf): Pass the third arg to
+ gv-define-simple-setter (bug#12812).
+
+ * woman.el (woman-decode-region): Disable adaptive-fill when rendering
+ (bug#12756).
+
+2012-11-10 Glenn Morris <rgm@gnu.org>
+
+ * emacs-lisp/gv.el (gv-define-setter): Fix doc typo.
+
+ * emacs-lisp/cl-extra.el (cl-prettyexpand):
+ * emacs-lisp/cl-lib.el (cl-proclaim, cl-declaim):
+ * emacs-lisp/cl-macs.el (cl-destructuring-bind, cl-locally)
+ (cl-the, cl-compiler-macroexpand): Add basic doc strings.
+
+ * emacs-lisp/cl-extra.el (cl-maplist, cl-mapcan): Doc fix.
+
2012-11-10 Leo Liu <sdl.web@gmail.com>
* ido.el (ido-set-matches-1): Improve flex matching performance by
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 42c25a4613d..8239522c0f8 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -1709,7 +1709,8 @@
;; During a normal load this is a noop:
(require 'advice-preload "advice.el")
(require 'macroexp)
-(eval-when-compile (require 'cl-lib))
+;; At run-time also, since ad-do-advised-functions returns code that uses it.
+(require 'cl-lib)
;; @@ Variable definitions:
;; ========================
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index a57de344cf3..7c25972835b 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -131,7 +131,7 @@ TYPE is the sequence type to return.
;;;###autoload
(defun cl-maplist (cl-func cl-list &rest cl-rest)
"Map FUNCTION to each sublist of LIST or LISTs.
-Like `mapcar', except applies to lists and their cdr's rather than to
+Like `cl-mapcar', except applies to lists and their cdr's rather than to
the elements themselves.
\n(fn FUNCTION LIST...)"
(if cl-rest
@@ -170,7 +170,7 @@ the elements themselves.
;;;###autoload
(defun cl-mapcan (cl-func cl-seq &rest cl-rest)
- "Like `mapcar', but nconc's together the values returned by the function.
+ "Like `cl-mapcar', but nconc's together the values returned by the function.
\n(fn FUNCTION SEQUENCE...)"
(apply 'nconc (apply 'cl-mapcar cl-func cl-seq cl-rest)))
@@ -675,6 +675,9 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
;;;###autoload
(defun cl-prettyexpand (form &optional full)
+ "Expand macros in FORM and insert the pretty-printed result.
+Optional argument FULL non-nil means to expand all macros,
+including `cl-block' and `cl-eval-when'."
(message "Expanding...")
(let ((cl--compiling-file full)
(byte-compile-macro-environment nil))
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 034a5c7517e..a9be08b1383 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -251,12 +251,17 @@ one value.
(defvar cl-proclaims-deferred nil)
(defun cl-proclaim (spec)
+ "Record a global declaration specified by SPEC."
(if (fboundp 'cl-do-proclaim) (cl-do-proclaim spec t)
(push spec cl-proclaims-deferred))
nil)
(defmacro cl-declaim (&rest specs)
- (let ((body (mapcar (function (lambda (x) (list 'cl-proclaim (list 'quote x))))
+ "Like `cl-proclaim', but takes any number of unevaluated, unquoted arguments.
+Puts `(cl-eval-when (compile load eval) ...)' around the declarations
+so that they are registered at compile-time as well as run-time."
+ (let ((body (mapcar (function (lambda (x)
+ (list 'cl-proclaim (list 'quote x))))
specs)))
(if (cl--compiling-file) (cl-list* 'cl-eval-when '(compile load eval) body)
(cons 'progn body)))) ; avoid loading cl-macs.el for cl-eval-when
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 8d240774edb..b28f8f7f9e9 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -554,6 +554,7 @@ its argument list allows full Common Lisp conventions."
;;;###autoload
(defmacro cl-destructuring-bind (args expr &rest body)
+ "Bind the variables in ARGS to the result of EXPR and execute BODY."
(declare (indent 2)
(debug (&define cl-macro-list def-form cl-declarations def-body)))
(let* ((cl--bind-lets nil) (cl--bind-forms nil) (cl--bind-inits nil)
@@ -1886,10 +1887,12 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
;;;###autoload
(defmacro cl-locally (&rest body)
+ "Equivalent to `progn'."
(declare (debug t))
(cons 'progn body))
;;;###autoload
(defmacro cl-the (_type form)
+ "At present this ignores _TYPE and is simply equivalent to FORM."
(declare (indent 1) (debug (cl-type-spec form)))
form)
@@ -2537,6 +2540,10 @@ and then returning foo."
;;;###autoload
(defun cl-compiler-macroexpand (form)
+ "Like `macroexpand', but for compiler macros.
+Expands FORM repeatedly until no further expansion is possible.
+Returns FORM unchanged if it has no compiler macro, or if it has a
+macro that returns its `&whole' argument."
(while
(let ((func (car-safe form)) (handler nil))
(while (and (symbolp func)
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index d3ef83961e2..016967bc713 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -547,13 +547,15 @@ deprecated usage of `symbol-function' in place forms)." ; bug#12760
(defmacro define-setf-expander (name arglist &rest body)
"Define a `setf' method.
-This method shows how to handle `setf's to places of the form (NAME ARGS...).
-The argument forms ARGS are bound according to ARGLIST, as if NAME were
-going to be expanded as a macro, then the BODY forms are executed and must
-return a list of five elements: a temporary-variables list, a value-forms
-list, a store-variables list (of length one), a store-form, and an access-
-form. See `gv-define-expander', `gv-define-setter', and `gv-define-expander'
-for a better and simpler ways to define setf-methods."
+This method shows how to handle `setf's to places of the form
+\(NAME ARGS...). The argument forms ARGS are bound according to
+ARGLIST, as if NAME were going to be expanded as a macro, then
+the BODY forms are executed and must return a list of five elements:
+a temporary-variables list, a value-forms list, a store-variables list
+\(of length one), a store-form, and an access- form.
+
+See `gv-define-expander', and `gv-define-setter' for better and
+simpler ways to define setf-methods."
(declare (debug
(&define name cl-lambda-list cl-declarations-or-string def-body)))
`(progn
@@ -566,23 +568,31 @@ for a better and simpler ways to define setf-methods."
(defmacro defsetf (name arg1 &rest args)
"Define a `setf' method.
-This macro is an easy-to-use substitute for `define-setf-expander' that works
-well for simple place forms. In the simple `defsetf' form, `setf's of
-the form (setf (NAME ARGS...) VAL) are transformed to function or macro
-calls of the form (FUNC ARGS... VAL). Example:
+This macro is an easy-to-use substitute for `define-setf-expander'
+that works well for simple place forms.
+
+In the simple `defsetf' form, `setf's of the form (setf (NAME
+ARGS...) VAL) are transformed to function or macro calls of the
+form (FUNC ARGS... VAL). For example:
(defsetf aref aset)
+You can replace this form with `gv-define-simple-setter'.
+
Alternate form: (defsetf NAME ARGLIST (STORE) BODY...).
-Here, the above `setf' call is expanded by binding the argument forms ARGS
-according to ARGLIST, binding the value form VAL to STORE, then executing
-BODY, which must return a Lisp form that does the necessary `setf' operation.
-Actually, ARGLIST and STORE may be bound to temporary variables which are
-introduced automatically to preserve proper execution order of the arguments.
-Example:
+
+Here, the above `setf' call is expanded by binding the argument
+forms ARGS according to ARGLIST, binding the value form VAL to
+STORE, then executing BODY, which must return a Lisp form that
+does the necessary `setf' operation. Actually, ARGLIST and STORE
+may be bound to temporary variables which are introduced
+automatically to preserve proper execution order of the arguments.
+For example:
(defsetf nth (n x) (v) `(setcar (nthcdr ,n ,x) ,v))
+You can replace this form with `gv-define-setter'.
+
\(fn NAME [FUNC | ARGLIST (STORE) BODY...])"
(declare (debug
(&define name
@@ -597,7 +607,7 @@ Example:
(cl-function
(lambda (,@(car args) ,@arg1) ,@(cdr args)))
do args)))
- `(gv-define-simple-setter ,name ,arg1)))
+ `(gv-define-simple-setter ,name ,arg1 ,(car args))))
;; FIXME: CL used to provide a setf method for `apply', but I haven't been able
;; to find a case where it worked. The code below tries to handle it as well.
@@ -639,8 +649,12 @@ Example:
(defmacro define-modify-macro (name arglist func &optional doc)
"Define a `setf'-like modify macro.
-If NAME is called, it combines its PLACE argument with the other arguments
-from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)"
+If NAME is called, it combines its PLACE argument with the other
+arguments from ARGLIST using FUNC. For example:
+
+ (define-modify-macro incf (&optional (n 1)) +)
+
+You can replace this macro with `gv-letplace'."
(declare (debug
(&define name cl-lambda-list ;; should exclude &key
symbolp &optional stringp)))
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 456bace5b1b..58bfae5b503 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -111,7 +111,7 @@ DO must return an Elisp expression."
GETTER will be bound to a copyable expression that returns the value
of PLACE.
SETTER will be bound to a function that takes an expression V and returns
-and new expression that sets PLACE to V.
+a new expression that sets PLACE to V.
BODY should return some Elisp expression E manipulating PLACE via GETTER
and SETTER.
The returned value will then be an Elisp expression that first evaluates
@@ -194,7 +194,7 @@ well for simple place forms.
Assignments of VAL to (NAME ARGS...) are expanded by binding the argument
forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must
return a Lisp form that does the assignment.
-The first arg in ARLIST (the one that receives VAL) receives an expression
+The first arg in ARGLIST (the one that receives VAL) receives an expression
which can do arbitrary things, whereas the other arguments are all guaranteed
to be pure and copyable. Example use:
(gv-define-setter aref (v a i) `(aset ,a ,i ,v))"
@@ -209,13 +209,20 @@ to be pure and copyable. Example use:
This macro is an easy-to-use substitute for `gv-define-expander' that works
well for simple place forms. Assignments of VAL to (NAME ARGS...) are
turned into calls of the form (SETTER ARGS... VAL).
+
If FIX-RETURN is non-nil, then SETTER is not assumed to return VAL and
-instead the assignment is turned into (prog1 VAL (SETTER ARGS... VAL))
+instead the assignment is turned into something equivalent to
+ \(let ((temp VAL))
+ (SETTER ARGS... temp)
+ temp)
so as to preserve the semantics of `setf'."
(declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
- (let ((set-call `(cons ',setter (append args (list val)))))
`(gv-define-setter ,name (val &rest args)
- ,(if fix-return `(list 'prog1 val ,set-call) set-call))))
+ ,(if fix-return
+ `(macroexp-let2 nil v val
+ (cons ',setter (append args (list v)))
+ v)
+ `(cons ',setter (append args (list val))))))
;;; Typical operations on generalized variables.
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 0066847e995..a7a167d01bd 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -517,7 +517,6 @@ and send the mail again%s."
buglist))))
(report-emacs-bug-create-existing-bugs-buffer (nreverse buglist) keywords)))
-;;;###autoload
(defun report-emacs-bug-query-existing-bugs (keywords)
"Query for KEYWORDS at `report-emacs-bug-tracker-url', and return the result.
The result is an alist with items of the form (URL SUBJECT NO)."
@@ -527,6 +526,8 @@ The result is an alist with items of the form (URL SUBJECT NO)."
(replace-regexp-in-string "[[:space:]]+" "+" keywords)
";package=emacs")
'report-emacs-bug-parse-query-results (list keywords)))
+(make-obsolete 'report-emacs-bug-query-existing-bugs
+ "use the `debbugs' package from GNU ELPA instead." "24.3")
(provide 'emacsbug)
diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el
index 92d5ec821b0..950c28b227f 100644
--- a/lisp/minibuf-eldef.el
+++ b/lisp/minibuf-eldef.el
@@ -33,13 +33,25 @@
;;; Code:
-(defvar minibuffer-eldef-shorten-default nil
- "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts.")
+(defvar minibuffer-eldef-shorten-default)
-(defvar minibuffer-default-in-prompt-regexps
+(defun minibuffer-default--in-prompt-regexps ()
`(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'"
1 ,(if minibuffer-eldef-shorten-default " [\\2]"))
- ("\\( \\[.*\\]\\):? *\\'" 1))
+ ("\\( \\[.*\\]\\):? *\\'" 1)))
+
+(defcustom minibuffer-eldef-shorten-default nil
+ "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts."
+ :set (lambda (symbol value)
+ (set-default symbol value)
+ (setq-default minibuffer-default-in-prompt-regexps
+ (minibuffer-default--in-prompt-regexps)))
+ :type 'boolean
+ :group 'minibuffer
+ :version "24.3")
+
+(defvar minibuffer-default-in-prompt-regexps
+ (minibuffer-default--in-prompt-regexps)
"A list of regexps matching the parts of minibuffer prompts showing defaults.
When `minibuffer-electric-default-mode' is active, these regexps are
used to identify the portions of prompts to elide.
diff --git a/lisp/server.el b/lisp/server.el
index 7a356a90378..c78e3e376aa 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -842,6 +842,15 @@ This handles splitting the command if it would be bigger than
(unless (assq w window-system-initialization-alist)
(setq w nil))
+ ;; Special case for ns. This is because DISPLAY may not be set at all
+ ;; which in the ns case isn't an error. The variable display then becomes
+ ;; the fully qualified hostname, which make-frame-on-display below
+ ;; does not understand and throws an error.
+ ;; It may also be a valid X display, but if Emacs is compiled for ns, it
+ ;; can not make X frames.
+ (if (featurep 'ns-win)
+ (setq w 'ns display "ns"))
+
(cond (w
;; Flag frame as client-created, but use a dummy client.
;; This will prevent the frame from being deleted when
diff --git a/lisp/term.el b/lisp/term.el
index 7567bd38f5a..e6466b8fa95 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -452,7 +452,7 @@ state 4: term-terminal-parameter contains pending output.")
"A queue of strings whose echo we want suppressed.")
(defvar term-terminal-parameter)
(defvar term-terminal-previous-parameter)
-(defvar term-current-face 'term-face)
+(defvar term-current-face 'term)
(defvar term-scroll-start 0 "Top-most line (inclusive) of scrolling region.")
(defvar term-scroll-end) ; Number of line (zero-based) after scrolling region.
(defvar term-pager-count nil
@@ -759,7 +759,7 @@ Buffer local variable.")
;;; Faces
(defvar ansi-term-color-vector
- [term-face
+ [term
term-color-black
term-color-red
term-color-green
@@ -770,18 +770,20 @@ Buffer local variable.")
term-color-white])
(defcustom term-default-fg-color nil
- "If non-nil, default color for foreground in Term mode.
-This is deprecated in favor of customizing the `term-face' face."
+ "If non-nil, default color for foreground in Term mode."
:group 'term
:type 'string)
+(make-obsolete-variable 'term-default-fg-color "use the face `term' instead."
+ "24.3")
(defcustom term-default-bg-color nil
- "If non-nil, default color for foreground in Term mode.
-This is deprecated in favor of customizing the `term-face' face."
+ "If non-nil, default color for foreground in Term mode."
:group 'term
:type 'string)
+(make-obsolete-variable 'term-default-bg-color "use the face `term' instead."
+ "24.3")
-(defface term-face
+(defface term
`((t
:foreground ,term-default-fg-color
:background ,term-default-bg-color
@@ -988,7 +990,7 @@ is buffer-local."
dt))
(defun term-ansi-reset ()
- (setq term-current-face 'term-face)
+ (setq term-current-face 'term)
(setq term-ansi-current-underline nil)
(setq term-ansi-current-bold nil)
(setq term-ansi-current-reverse nil)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 49b76a8e3bc..26c64ce2ad3 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -178,7 +178,7 @@ when editing big diffs)."
["Unified -> Context" diff-unified->context
:help "Convert unified diffs to context diffs"]
;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)]
- ["Remove trailing whitespace" diff-remove-trailing-whitespace
+ ["Remove trailing whitespace" diff-delete-trailing-whitespace
:help "Remove trailing whitespace problems introduced by the diff"]
["Show trailing whitespace" whitespace-mode
:style toggle :selected (bound-and-true-p whitespace-mode)
@@ -2048,35 +2048,71 @@ I.e. like `add-change-log-entry-other-window' but applied to all hunks."
;; When there's no more hunks, diff-hunk-next signals an error.
(error nil))))
-(defun diff-remove-trailing-whitespace ()
- "When on a buffer that contains a diff, inspects the
-differences and removes trailing whitespace (spaces, tabs) from
-the lines modified or introduced by this diff. Shows a message
-with the name of the altered buffers, which are unsaved. If a
-file referenced on the diff has no buffer and needs to be fixed,
-a buffer visiting that file is created."
- (interactive)
- ;; We assume that the diff header has no trailing whitespace.
- (let ((modified-buffers nil))
- (save-excursion
- (goto-char (point-min))
- (while (re-search-forward "^[+!>].*[ \t]+$" (point-max) t)
- (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,_switched)
- (diff-find-source-location t t)))
- (when line-offset
- (with-current-buffer buf
- (save-excursion
- (goto-char (+ (car pos) (cdr src)))
- (beginning-of-line)
- (when (re-search-forward "\\([ \t]+\\)$" (line-end-position) t)
- (unless (memq buf modified-buffers)
- (push buf modified-buffers))
- (replace-match ""))))))))
- (if modified-buffers
- (message "Deleted new trailing whitespace from: %s"
- (mapconcat (lambda (buf) (concat "`" (buffer-name buf) "'"))
- modified-buffers " "))
- (message "No trailing whitespace fixes needed."))))
+(defun diff-delete-trailing-whitespace (&optional other-file)
+ "Remove trailing whitespace from lines modified in this diff.
+This edits both the current Diff mode buffer and the patched
+source file(s). If `diff-jump-to-old-file' is non-nil, edit the
+original (unpatched) source file instead. With a prefix argument
+OTHER-FILE, flip the choice of which source file to edit.
+
+If a file referenced in the diff has no buffer and needs to be
+fixed, visit it in a buffer."
+ (interactive "P")
+ (save-excursion
+ (goto-char (point-min))
+ (let* ((other (diff-xor other-file diff-jump-to-old-file))
+ (modified-buffers nil)
+ (style (save-excursion
+ (when (re-search-forward diff-hunk-header-re nil t)
+ (goto-char (match-beginning 0))
+ (diff-hunk-style))))
+ (regexp (concat "^[" (if other "-<" "+>") "!]"
+ (if (eq style 'context) " " "")
+ ".*?\\([ \t]+\\)$"))
+ (inhibit-read-only t)
+ (end-marker (make-marker))
+ hunk-end)
+ ;; Move to the first hunk.
+ (re-search-forward diff-hunk-header-re nil 1)
+ (while (progn (save-excursion
+ (re-search-forward diff-hunk-header-re nil 1)
+ (setq hunk-end (point)))
+ (< (point) hunk-end))
+ ;; For context diffs, search only in the appropriate half of
+ ;; the hunk. For other diffs, search within the entire hunk.
+ (if (not (eq style 'context))
+ (set-marker end-marker hunk-end)
+ (let ((mid-hunk
+ (save-excursion
+ (re-search-forward diff-context-mid-hunk-header-re hunk-end)
+ (point))))
+ (if other
+ (set-marker end-marker mid-hunk)
+ (goto-char mid-hunk)
+ (set-marker end-marker hunk-end))))
+ (while (re-search-forward regexp end-marker t)
+ (let ((match-data (match-data)))
+ (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,_switched)
+ (diff-find-source-location other-file)))
+ (when line-offset
+ ;; Remove the whitespace in the Diff mode buffer.
+ (set-match-data match-data)
+ (replace-match "" t t nil 1)
+ ;; Remove the whitespace in the source buffer.
+ (with-current-buffer buf
+ (save-excursion
+ (goto-char (+ (car pos) (cdr src)))
+ (beginning-of-line)
+ (when (re-search-forward "\\([ \t]+\\)$" (line-end-position) t)
+ (unless (memq buf modified-buffers)
+ (push buf modified-buffers))
+ (replace-match ""))))))))
+ (goto-char hunk-end))
+ (if modified-buffers
+ (message "Deleted trailing whitespace from %s."
+ (mapconcat (lambda (buf) (concat "`" (buffer-name buf) "'"))
+ modified-buffers ", "))
+ (message "No trailing whitespace to delete.")))))
;; provide the package
(provide 'diff-mode)
diff --git a/lisp/woman.el b/lisp/woman.el
index e41c489dbfa..974a7d72465 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -2253,7 +2253,9 @@ Currently set only from '\" t in the first line of the source file.")
(set-face-font 'woman-symbol woman-symbol-font
(and (frame-live-p woman-frame) woman-frame)))
- ;; Set syntax and display tables:
+ (setq-local adaptive-fill-mode nil) ; No special "%" "#" etc filling.
+
+ ;; Set syntax and display tables:
(set-syntax-table woman-syntax-table)
(woman-set-buffer-display-table)