summaryrefslogtreecommitdiff
path: root/lisp/vc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/add-log.el3
-rw-r--r--lisp/vc/compare-w.el4
-rw-r--r--lisp/vc/cvs-status.el27
-rw-r--r--lisp/vc/diff-mode.el185
-rw-r--r--lisp/vc/diff.el18
-rw-r--r--lisp/vc/ediff-diff.el39
-rw-r--r--lisp/vc/ediff-help.el6
-rw-r--r--lisp/vc/ediff-init.el244
-rw-r--r--lisp/vc/ediff-merg.el8
-rw-r--r--lisp/vc/ediff-mult.el82
-rw-r--r--lisp/vc/ediff-ptch.el35
-rw-r--r--lisp/vc/ediff-util.el118
-rw-r--r--lisp/vc/ediff-vers.el4
-rw-r--r--lisp/vc/ediff-wind.el92
-rw-r--r--lisp/vc/ediff.el30
-rw-r--r--lisp/vc/emerge.el133
-rw-r--r--lisp/vc/log-edit.el38
-rw-r--r--lisp/vc/log-view.el55
-rw-r--r--lisp/vc/pcvs-defs.el154
-rw-r--r--lisp/vc/pcvs.el164
-rw-r--r--lisp/vc/smerge-mode.el48
-rw-r--r--lisp/vc/vc-annotate.el8
-rw-r--r--lisp/vc/vc-bzr.el7
-rw-r--r--lisp/vc/vc-cvs.el14
-rw-r--r--lisp/vc/vc-dav.el11
-rw-r--r--lisp/vc/vc-dir.el41
-rw-r--r--lisp/vc/vc-dispatcher.el11
-rw-r--r--lisp/vc/vc-git.el108
-rw-r--r--lisp/vc/vc-hg.el38
-rw-r--r--lisp/vc/vc-hooks.el13
-rw-r--r--lisp/vc/vc-rcs.el64
-rw-r--r--lisp/vc/vc-sccs.el6
-rw-r--r--lisp/vc/vc-src.el11
-rw-r--r--lisp/vc/vc-svn.el4
-rw-r--r--lisp/vc/vc.el131
35 files changed, 983 insertions, 971 deletions
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index 2e20284951f..1290d7e03a5 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -930,8 +930,7 @@ non-nil, otherwise in local time."
(not (looking-at "[ \t]+.*<.*>$")))
(setq hit t)))))
(forward-line 1)
- (insert (nth (random (length new-entries))
- new-entries)
+ (insert (and new-entries (seq-random-elt new-entries))
(if use-hard-newlines hard-newline "\n")
(if use-hard-newlines hard-newline "\n"))
(forward-line -1))))
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index 4c1d9eaad55..29dfaa7668d 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -113,7 +113,7 @@ and the value `((4) (4))' for horizontally split windows."
:version "22.1")
(defcustom compare-windows-highlight t
- "Non-nil means compare-windows highlights the differences.
+ "Non-nil means `compare-windows' highlights the differences.
The value t removes highlighting immediately after invoking a command
other than `compare-windows'.
The value `persistent' leaves all highlighted differences. You can clear
@@ -188,7 +188,7 @@ If both windows display the same buffer,
the mark is pushed twice in that buffer:
first in the other window, then in the selected window.
-A prefix arg means reverse the value of variable
+A prefix arg IGNORE-WHITESPACE, means reverse the value of variable
`compare-ignore-whitespace'. If `compare-ignore-whitespace' is
nil, then a prefix arg means ignore changes in whitespace. If
`compare-ignore-whitespace' is non-nil, then a prefix arg means
diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el
index 63b886362ba..86b62eb1ce6 100644
--- a/lisp/vc/cvs-status.el
+++ b/lisp/vc/cvs-status.el
@@ -29,23 +29,22 @@
;;; Code:
(require 'cl-lib)
-(require 'pcvs-util)
+(require 'pcvs)
+(require 'easy-mmode)
;;;
-(easy-mmode-defmap cvs-status-mode-map
- '(("n" . next-line)
- ("p" . previous-line)
- ("N" . cvs-status-next)
- ("P" . cvs-status-prev)
- ("\M-n" . cvs-status-next)
- ("\M-p" . cvs-status-prev)
- ("t" . cvs-status-cvstrees)
- ("T" . cvs-status-trees)
- (">" . cvs-mode-checkout))
- "CVS-Status' keymap."
- :group 'cvs-status
- :inherit 'cvs-mode-map)
+(defvar-keymap cvs-status-mode-map
+ :parent 'cvs-mode-map
+ "n" #'next-line
+ "p" #'previous-line
+ "N" #'cvs-status-next
+ "P" #'cvs-status-prev
+ ["M-n"] #'cvs-status-next
+ ["M-p"] #'cvs-status-prev
+ "t" #'cvs-status-cvstrees
+ "T" #'cvs-status-trees
+ ">" #'cvs-mode-checkout)
;;(easy-menu-define cvs-status-menu cvs-status-mode-map
;; "Menu for `cvs-status-mode'."
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 4652afa1f92..e68aa2257d2 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -55,6 +55,7 @@
;;; Code:
(eval-when-compile (require 'cl-lib))
(eval-when-compile (require 'subr-x))
+(require 'easy-mmode)
(autoload 'vc-find-revision "vc")
(autoload 'vc-find-revision-no-save "vc")
@@ -162,57 +163,55 @@ and hunk-based syntax highlighting otherwise as a fallback."
;;;; keymap, menu, ...
;;;;
-(easy-mmode-defmap diff-mode-shared-map
- '(("n" . diff-hunk-next)
- ("N" . diff-file-next)
- ("p" . diff-hunk-prev)
- ("P" . diff-file-prev)
- ("\t" . diff-hunk-next)
- ([backtab] . diff-hunk-prev)
- ("k" . diff-hunk-kill)
- ("K" . diff-file-kill)
- ("}" . diff-file-next) ; From compilation-minor-mode.
- ("{" . diff-file-prev)
- ("\C-m" . diff-goto-source)
- ([mouse-2] . diff-goto-source)
- ("W" . widen)
- ("o" . diff-goto-source) ; other-window
- ("A" . diff-ediff-patch)
- ("r" . diff-restrict-view)
- ("R" . diff-reverse-direction)
- ([remap undo] . diff-undo))
- "Basic keymap for `diff-mode', bound to various prefix keys."
- :inherit special-mode-map)
-
-(easy-mmode-defmap diff-mode-map
- `(("\e" . ,(let ((map (make-sparse-keymap)))
- ;; We want to inherit most bindings from diff-mode-shared-map,
- ;; but not all since they may hide useful M-<foo> global
- ;; bindings when editing.
- (set-keymap-parent map diff-mode-shared-map)
- (dolist (key '("A" "r" "R" "g" "q" "W" "z"))
- (define-key map key nil))
- map))
- ;; From compilation-minor-mode.
- ("\C-c\C-c" . diff-goto-source)
- ;; By analogy with the global C-x 4 a binding.
- ("\C-x4A" . diff-add-change-log-entries-other-window)
- ;; Misc operations.
- ("\C-c\C-a" . diff-apply-hunk)
- ("\C-c\C-e" . diff-ediff-patch)
- ("\C-c\C-n" . diff-restrict-view)
- ("\C-c\C-s" . diff-split-hunk)
- ("\C-c\C-t" . diff-test-hunk)
- ("\C-c\C-r" . diff-reverse-direction)
- ("\C-c\C-u" . diff-context->unified)
- ;; `d' because it duplicates the context :-( --Stef
- ("\C-c\C-d" . diff-unified->context)
- ("\C-c\C-w" . diff-ignore-whitespace-hunk)
- ;; `l' because it "refreshes" the hunk like C-l refreshes the screen
- ("\C-c\C-l" . diff-refresh-hunk)
- ("\C-c\C-b" . diff-refine-hunk) ;No reason for `b' :-(
- ("\C-c\C-f" . next-error-follow-minor-mode))
- "Keymap for `diff-mode'. See also `diff-mode-shared-map'.")
+(defvar-keymap diff-mode-shared-map
+ :parent special-mode-map
+ "n" #'diff-hunk-next
+ "N" #'diff-file-next
+ "p" #'diff-hunk-prev
+ "P" #'diff-file-prev
+ ["TAB"] #'diff-hunk-next
+ [backtab] #'diff-hunk-prev
+ "k" #'diff-hunk-kill
+ "K" #'diff-file-kill
+ "}" #'diff-file-next ; From compilation-minor-mode.
+ "{" #'diff-file-prev
+ ["RET"] #'diff-goto-source
+ [mouse-2] #'diff-goto-source
+ "W" #'widen
+ "o" #'diff-goto-source ; other-window
+ "A" #'diff-ediff-patch
+ "r" #'diff-restrict-view
+ "R" #'diff-reverse-direction
+ [remap undo] #'diff-undo)
+
+(defvar-keymap diff-mode-map
+ :doc "Keymap for `diff-mode'. See also `diff-mode-shared-map'."
+ ["ESC"] (let ((map (define-keymap :parent diff-mode-shared-map)))
+ ;; We want to inherit most bindings from
+ ;; `diff-mode-shared-map', but not all since they may hide
+ ;; useful `M-<foo>' global bindings when editing.
+ (dolist (key '("A" "r" "R" "g" "q" "W" "z"))
+ (define-key map key nil))
+ map)
+ ;; From compilation-minor-mode.
+ ["C-c C-c"] #'diff-goto-source
+ ;; By analogy with the global C-x 4 a binding.
+ ["C-x 4 A"] #'diff-add-change-log-entries-other-window
+ ;; Misc operations.
+ ["C-c C-a"] #'diff-apply-hunk
+ ["C-c C-e"] #'diff-ediff-patch
+ ["C-c C-n"] #'diff-restrict-view
+ ["C-c C-s"] #'diff-split-hunk
+ ["C-c C-t"] #'diff-test-hunk
+ ["C-c C-r"] #'diff-reverse-direction
+ ["C-c C-u"] #'diff-context->unified
+ ;; `d' because it duplicates the context :-( --Stef
+ ["C-c C-d"] #'diff-unified->context
+ ["C-c C-w"] #'diff-ignore-whitespace-hunk
+ ;; `l' because it "refreshes" the hunk like C-l refreshes the screen
+ ["C-c C-l"] #'diff-refresh-hunk
+ ["C-c C-b"] #'diff-refine-hunk ;No reason for `b' :-(
+ ["C-c C-f"] #'next-error-follow-minor-mode)
(easy-menu-define diff-mode-menu diff-mode-map
"Menu for `diff-mode'."
@@ -269,9 +268,9 @@ and hunk-based syntax highlighting otherwise as a fallback."
"Prefix key for `diff-minor-mode' commands."
:type '(choice (string "\e") (string "C-c=") string))
-(easy-mmode-defmap diff-minor-mode-map
- `((,diff-minor-mode-prefix . ,diff-mode-shared-map))
- "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.")
+(defvar-keymap diff-minor-mode-map
+ :doc "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'."
+ diff-minor-mode-prefix diff-mode-shared-map)
(define-minor-mode diff-auto-refine-mode
"Toggle automatic diff hunk finer highlighting (Diff Auto Refine mode).
@@ -357,6 +356,18 @@ well."
:foreground "green" :extend t))
"`diff-mode' face used to highlight added lines.")
+(defface diff-changed-unspecified
+ '((default
+ :inherit diff-changed)
+ (((class color) (min-colors 88) (background light))
+ :background "grey90" :extend t)
+ (((class color) (min-colors 88) (background dark))
+ :background "grey20" :extend t)
+ (((class color))
+ :foreground "grey" :extend t))
+ "`diff-mode' face used to highlight changed lines."
+ :version "28.1")
+
(defface diff-changed
'((t nil))
"`diff-mode' face used to highlight changed lines."
@@ -436,9 +447,10 @@ well."
(defvar diff-use-changed-face (and (face-differs-from-default-p 'diff-changed)
(not (face-equal 'diff-changed 'diff-added))
(not (face-equal 'diff-changed 'diff-removed)))
- "If non-nil, use the face `diff-changed' for changed lines in context diffs.
-Otherwise, use the face `diff-removed' for removed lines,
-and the face `diff-added' for added lines.")
+ "Controls how changed lines are fontified in context diffs.
+If non-nil, use the face `diff-changed-unspecified'. Otherwise,
+use the face `diff-removed' for removed lines, and the face
+`diff-added' for added lines.")
(defvar diff-font-lock-keywords
`((,(concat "\\(" diff-hunk-header-re-unified "\\)\\(.*\\)$")
@@ -470,7 +482,7 @@ and the face `diff-added' for added lines.")
diff-indicator-added-face
diff-indicator-removed-face)))))
(2 (if diff-use-changed-face
- 'diff-changed
+ 'diff-changed-unspecified
;; Otherwise, use the same method as above.
(save-match-data
(let ((limit (save-excursion (diff-beginning-of-hunk))))
@@ -881,6 +893,9 @@ data such as \"Index: ...\" and such."
;; Fix the original hunk-header.
(diff-fixup-modifs start pos))))
+(defun diff--outline-level ()
+ (if (string-match-p diff-hunk-header-re (match-string 0))
+ 2 1))
;;;;
;;;; jump to other buffers
@@ -956,11 +971,11 @@ If the OLD prefix arg is passed, tell the file NAME of the old file."
(list (match-string 1)))
header-files
;; this assumes that there are no spaces in filenames
- (when (re-search-backward
- "^diff \\(-\\S-+ +\\)*\\(\\S-+\\)\\( +\\(\\S-+\\)\\)?"
- nil t)
- (list (if old (match-string 2) (match-string 4))
- (if old (match-string 4) (match-string 2)))))))))
+ (and (re-search-backward "^diff " nil t)
+ (looking-at
+ "^diff \\(-[^ \t\nL]+ +\\)*\\(-L +\\S-+ +\\)*\\(\\S-+\\)\\( +\\(\\S-+\\)\\)?")
+ (list (if old (match-string 3) (match-string 5))
+ (if old (match-string 4) (match-string 3)))))))))
(defun diff-find-file-name (&optional old noprompt prefix)
"Return the file corresponding to the current patch.
@@ -1342,7 +1357,11 @@ else cover the whole buffer."
(pcase (char-after)
(?\s (cl-incf space))
(?+ (cl-incf plus))
- (?- (cl-incf minus))
+ (?- (unless ;; In git format-patch "^-- $" signifies
+ ;; the end of the patch.
+ (and (eq diff-buffer-type 'git)
+ (looking-at "^-- $"))
+ (cl-incf minus)))
(?! (cl-incf bang))
((or ?\\ ?#) nil)
(?\n (if diff-valid-unified-empty-line
@@ -1466,7 +1485,7 @@ Supports unified and context diffs as well as (to a lesser extent)
normal diffs.
When the buffer is read-only, the ESC prefix is not necessary.
-If you edit the buffer manually, diff-mode will try to update the hunk
+If you edit the buffer manually, `diff-mode' will try to update the hunk
headers for you on-the-fly.
You can also switch between context diff and unified diff with \\[diff-context->unified],
@@ -1477,7 +1496,6 @@ a diff with \\[diff-reverse-direction].
(setq-local font-lock-defaults diff-font-lock-defaults)
(add-hook 'font-lock-mode-hook #'diff--font-lock-cleanup nil 'local)
- (setq-local outline-regexp diff-outline-regexp)
(setq-local imenu-generic-expression
diff-imenu-generic-expression)
;; These are not perfect. They would be better done separately for
@@ -1522,11 +1540,7 @@ a diff with \\[diff-reverse-direction].
#'diff--filter-substring)
(unless buffer-file-name
(hack-dir-local-variables-non-file-buffer))
- (save-excursion
- (setq-local diff-buffer-type
- (if (re-search-forward "^diff --git" nil t)
- 'git
- nil))))
+ (diff-setup-buffer-type))
;;;###autoload
(define-minor-mode diff-minor-mode
@@ -1562,6 +1576,21 @@ modified lines of the diff."
"^[-+!] .*?\\([\t ]+\\)$"
"^[-+!<>].*?\\([\t ]+\\)$"))))
+(defun diff-setup-buffer-type ()
+ "Try to guess the `diff-buffer-type' from content of current Diff mode buffer.
+`outline-regexp' is updated accordingly."
+ (save-excursion
+ (goto-char (point-min))
+ (setq-local diff-buffer-type
+ (if (re-search-forward "^diff --git" nil t)
+ 'git
+ nil)))
+ (when (eq diff-buffer-type 'git)
+ (setq diff-outline-regexp
+ (concat "\\(^diff --git.*\n\\|" diff-hunk-header-re "\\)"))
+ (setq-local outline-level #'diff--outline-level))
+ (setq-local outline-regexp diff-outline-regexp))
+
(defun diff-delete-if-empty ()
;; An empty diff file means there's no more diffs to integrate, so we
;; can just remove the file altogether. Very handy for .rej files if we
@@ -2586,13 +2615,15 @@ fixed, visit it in a buffer."
(or (match-beginning 2) (match-beginning 1))
'display (propertize
(cond
- ((null (match-beginning 1)) "new file ")
- ((null (match-beginning 2)) "deleted ")
- (t "modified "))
+ ((null (match-beginning 1))
+ (concat "new file " (match-string 2)))
+ ((null (match-beginning 2))
+ (concat "deleted " (match-string 1)))
+ (t
+ (concat "modified " (match-string 1))))
'face '(diff-file-header diff-header)))
- (unless (match-beginning 2)
- (put-text-property (match-end 1) (1- (match-end 0))
- 'display "")))))
+ (put-text-property (match-end 1) (1- (match-end 0))
+ 'display ""))))
nil)
;;; Syntax highlighting from font-lock
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index 7bb1151602c..4061fedd578 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -87,24 +87,24 @@ minibuffer. The default for NEW is the current buffer's file
name, and the default for OLD is a backup file for NEW, if one
exists. If NO-ASYNC is non-nil, call diff synchronously.
-When called interactively with a prefix argument, prompt
+When called interactively with a prefix argument SWITCHES, prompt
interactively for diff switches. Otherwise, the switches
-specified in the variable `diff-switches' are passed to the
-diff command.
+specified in the variable `diff-switches' are passed to the diff
+command.
Non-interactively, OLD and NEW may each be a file or a buffer."
(interactive
(let* ((newf (if (and buffer-file-name (file-exists-p buffer-file-name))
(read-file-name
- (concat "Diff new file (default "
- (file-name-nondirectory buffer-file-name) "): ")
+ (format-prompt "Diff new file"
+ (file-name-nondirectory buffer-file-name))
nil buffer-file-name t)
(read-file-name "Diff new file: " nil nil t)))
(oldf (file-newest-backup newf)))
(setq oldf (if (and oldf (file-exists-p oldf))
(read-file-name
- (concat "Diff original file (default "
- (file-name-nondirectory oldf) "): ")
+ (format-prompt "Diff original file"
+ (file-name-nondirectory oldf))
(file-name-directory oldf) oldf t)
(read-file-name "Diff original file: "
(file-name-directory newf) nil t)))
@@ -229,7 +229,7 @@ returns the buffer used."
Uses the latest backup, if there are several numerical backups.
If this file is a backup, diff it with its original.
The backup file is the first file given to `diff'.
-With prefix arg, prompt for diff switches."
+With prefix arg SWITCHES, prompt for diff switches."
(interactive (list (read-file-name "Diff (file with backup): ")
(diff-switches)))
(let (bak ori)
@@ -243,7 +243,7 @@ With prefix arg, prompt for diff switches."
;;;###autoload
(defun diff-latest-backup-file (fn)
- "Return the latest existing backup of FILE, or nil."
+ "Return the latest existing backup of file FN, or nil."
(let ((handler (find-file-name-handler fn 'diff-latest-backup-file)))
(if handler
(funcall handler 'diff-latest-backup-file fn)
diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el
index 0965e888f06..68abea794f0 100644
--- a/lisp/vc/ediff-diff.el
+++ b/lisp/vc/ediff-diff.el
@@ -24,7 +24,6 @@
;;; Code:
-
(require 'ediff-init)
(require 'ediff-util)
@@ -78,14 +77,14 @@ are `-I REGEXP', to ignore changes whose lines match the REGEXP."
"Options to pass to `ediff-diff-program'.
If Unix diff is used as `ediff-diff-program',
then a useful option is `-w', to ignore space.
-Options `-c', `-u', and `-i' are not allowed. Case sensitivity can be
+Options `-c', `-u', and `-i' are not allowed. Case sensitivity can be
toggled interactively using \\[ediff-toggle-ignore-case].
-Do not remove the default options. If you need to change this variable, add new
+Do not remove the default options. If you need to change this variable, add new
options after the default ones.
This variable is not for customizing the look of the differences produced by
-the command \\[ediff-show-diff-output]. Use the variable
+the command \\[ediff-show-diff-output]. Use the variable
`ediff-custom-diff-options' for that."
:set #'ediff-set-diff-options
:type 'string)
@@ -104,8 +103,8 @@ Use `setq-default' if setting it in .emacs")
GNU diff3 doesn't have such an option."
:type 'string)
-;; the actual options used in comparison
-(ediff-defvar-local ediff-actual-diff-options ediff-diff-options "")
+(ediff-defvar-local ediff-actual-diff-options ediff-diff-options
+ "The actual options used in comparison.")
(defcustom ediff-custom-diff-program ediff-diff-program
"Program to use for generating custom diff output for saving it in a file.
@@ -124,8 +123,8 @@ This output is not used by Ediff internally."
:set 'ediff-set-diff-options
:type 'string)
-;; the actual options used in comparison
-(ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "")
+(ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options
+ "The actual options used in comparison.")
(defcustom ediff-diff3-ok-lines-regexp
"^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
@@ -133,16 +132,16 @@ This output is not used by Ediff internally."
Lines that do not match are assumed to be error messages."
:type 'regexp)
-;; keeps the status of the current diff in 3-way jobs.
-;; the status can be =diff(A), =diff(B), or =diff(A+B)
-(ediff-defvar-local ediff-diff-status "" "")
+(ediff-defvar-local ediff-diff-status ""
+ "Keeps the status of the current diff in 3-way jobs.
+The status can be =diff(A), =diff(B), or =diff(A+B).")
;;; Fine differences
(ediff-defvar-local ediff-auto-refine (if (ediff-has-face-support-p) 'on 'nix)
"If `on', Ediff auto-highlights fine diffs for the current diff region.
-If `off', auto-highlighting is not used. If `nix', no fine diffs are shown
+If `off', auto-highlighting is not used. If `nix', no fine diffs are shown
at all, unless the user force-refines the region by hitting `*'.
This variable can be set either in .emacs or toggled interactively.
@@ -180,12 +179,12 @@ Lines that do not match are assumed to be error messages.")
"Pattern to match lines produced by diff that describe differences.")
(ediff-defvar-local ediff-setup-diff-regions-function nil
- "value is a function symbol depending on the kind of job is to be done.
-For 2-way jobs and for ediff-merge, it should be `ediff-setup-diff-regions'.
+ "Value is a function symbol depending on the kind of job is to be done.
+For 2-way jobs and for `ediff-merge', it should be `ediff-setup-diff-regions'.
For jobs requiring diff3, it should be `ediff-setup-diff-regions3'.
The function should take three mandatory arguments, file-A, file-B, and
-file-C. It may ignore file C for diff2 jobs. It should also take
+file-C. It may ignore file C for diff2 jobs. It should also take
one optional arguments, diff-number to refine.")
@@ -824,13 +823,10 @@ one optional arguments, diff-number to refine.")
(setq overlay-list (cons overlay overlay-list))
(if (> (length diff-list) 1)
(setq diff-list (cdr (cdr diff-list)))
- (error "ediff-set-fine-overlays-for-combined-merge: corrupt list of
-delimiter regions"))
- )
+ (error "Corrupt list of delimiter regions")))
(setq overlay-list (reverse overlay-list))
(ediff-set-fine-diff-vector
- reg-num 'C (apply #'vector overlay-list))
- ))
+ reg-num 'C (apply #'vector overlay-list))))
;; Convert diff list to overlays for a given DIFF-REGION
@@ -1462,8 +1458,7 @@ affects only files whose names match the expression."
(message "Ignoring letter case is not supported by this diff program"))
(t
(sit-for 1)
- (ediff-update-diffs)))
- )
+ (ediff-update-diffs))))
(provide 'ediff-diff)
;;; ediff-diff.el ends here
diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el
index a5bb953b6d4..0450cd7f23b 100644
--- a/lisp/vc/ediff-help.el
+++ b/lisp/vc/ediff-help.el
@@ -24,7 +24,6 @@
;;; Code:
-
;; Compiler pacifier start
(defvar ediff-multiframe)
;; end pacifier
@@ -127,9 +126,9 @@ Normally, not a user option. See `ediff-help-message' for details.")
(defconst ediff-brief-message-string
" Type ? for help"
"Contents of the brief help message.")
-;; The actual brief help message
(ediff-defvar-local ediff-brief-help-message ""
- "Normally, not a user option. See `ediff-help-message' for details.")
+ "The actual brief help message.
+Normally, not a user option. See `ediff-help-message' for details.")
(ediff-defvar-local ediff-brief-help-message-function nil
"The brief help message that the user can customize.
@@ -144,7 +143,6 @@ See `ediff-brief-help-message-function' for more.")
:type 'boolean
:group 'ediff-window)
-;; The actual help message.
(ediff-defvar-local ediff-help-message ""
"The actual help message.
Normally, the user shouldn't touch this. However, if you want Ediff to
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 17c4202d647..eaccb7a98c7 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -49,7 +49,6 @@ that Ediff doesn't know about.")
(declare (obsolete nil "27.1"))
window-system)
-;; in XEmacs: device-type is tty on tty and stream in batch.
(defun ediff-window-display-p ()
(and window-system
(not (memq window-system '(tty pc stream)))))
@@ -75,46 +74,45 @@ that Ediff doesn't know about.")
(boundp 'ediff-use-toolbar-p)
ediff-use-toolbar-p)) ;Does the user want it ?
-;; Defines VAR as an advertised local variable.
-;; Performs a defvar, then executes `make-variable-buffer-local' on
-;; the variable. Also sets the `permanent-local' property,
-;; so that `kill-all-local-variables' (called by major-mode setting
-;; commands) won't destroy Ediff control variables.
-;;
;; Plagiarized from `emerge-defvar-local'.
-(defmacro ediff-defvar-local (var value doc)
- "Defines VAR as a local variable."
+(defmacro ediff-defvar-local (symbol value &optional doc)
+ "Define SYMBOL as an advertised buffer-local variable.
+Run `defvar-local', setting the value of the variable to VALUE
+and its docstring to DOC.
+
+Then set the `permanent-local' property, so that
+`kill-all-local-variables' (called by major-mode setting
+commands) won't destroy Ediff control variables."
(declare (indent defun) (doc-string 3))
`(progn
- (defvar-local ,var ,value ,doc)
- (put ',var 'permanent-local t)))
+ (defvar-local ,symbol ,value ,doc)
+ (put ',symbol 'permanent-local t)))
;; Variables that control each Ediff session---local to the control buffer.
;; Mode variables
-;; The buffer in which the A variant is stored.
-(ediff-defvar-local ediff-buffer-A nil "")
-;; The buffer in which the B variant is stored.
-(ediff-defvar-local ediff-buffer-B nil "")
-;; The buffer in which the C variant is stored or where the merge buffer lives.
-(ediff-defvar-local ediff-buffer-C nil "")
-;; Ancestor buffer
-(ediff-defvar-local ediff-ancestor-buffer nil "")
-;; The Ediff control buffer
-(ediff-defvar-local ediff-control-buffer nil "")
+(ediff-defvar-local ediff-buffer-A nil
+ "The buffer in which the A variant is stored.")
+(ediff-defvar-local ediff-buffer-B nil
+ "The buffer in which the B variant is stored.")
+(ediff-defvar-local ediff-buffer-C nil
+ "The buffer in which the C variant is stored or where the merge buffer lives.")
+(ediff-defvar-local ediff-ancestor-buffer nil
+ "Ancestor buffer.")
+(ediff-defvar-local ediff-control-buffer nil
+ "The Ediff control buffer.")
(ediff-defvar-local ediff-temp-indirect-buffer nil
"If t, the buffer is a temporary indirect buffer.
It needs to be killed when we quit the session.")
-
-;; Association between buff-type and ediff-buffer-*
(defconst ediff-buffer-alist
'((?A . ediff-buffer-A)
(?B . ediff-buffer-B)
- (?C . ediff-buffer-C)))
+ (?C . ediff-buffer-C))
+ "Association between `buff-type' and `ediff-buffer-*'.")
;;; Macros
(defsubst ediff-buffer-live-p (buf)
@@ -162,10 +160,10 @@ It needs to be killed when we quit the session.")
;; no-fine-diffs-flag says if there are fine differences.
;; state-of-difference is A, B, C, or nil, indicating which buffer is
;; different from the other two (used only in 3-way jobs.
-(ediff-defvar-local ediff-difference-vector-A nil "")
-(ediff-defvar-local ediff-difference-vector-B nil "")
-(ediff-defvar-local ediff-difference-vector-C nil "")
-(ediff-defvar-local ediff-difference-vector-Ancestor nil "")
+(ediff-defvar-local ediff-difference-vector-A nil)
+(ediff-defvar-local ediff-difference-vector-B nil)
+(ediff-defvar-local ediff-difference-vector-C nil)
+(ediff-defvar-local ediff-difference-vector-Ancestor nil)
;; A-list of diff vector types associated with buffer types
(defconst ediff-difference-vector-alist
'((A . ediff-difference-vector-A)
@@ -249,7 +247,7 @@ It needs to be killed when we quit the session.")
;; Doesn't save the point and mark.
;; This is `with-current-buffer' with the added test for live buffers."
(defmacro ediff-with-current-buffer (buffer &rest body)
- "Evaluates BODY in BUFFER."
+ "Evaluate BODY in BUFFER."
(declare (indent 1) (debug (form body)))
`(if (ediff-buffer-live-p ,buffer)
(save-current-buffer
@@ -271,7 +269,7 @@ It needs to be killed when we quit the session.")
'(memq
ediff-job-name
'(ediff-files3 ediff-buffers3)))
-(ediff-defvar-local ediff-3way-comparison-job nil "")
+(ediff-defvar-local ediff-3way-comparison-job nil)
(defmacro ediff-merge-job ()
'(memq
@@ -282,7 +280,7 @@ It needs to be killed when we quit the session.")
ediff-merge-buffers-with-ancestor
ediff-merge-revisions
ediff-merge-revisions-with-ancestor)))
-(ediff-defvar-local ediff-merge-job nil "")
+(ediff-defvar-local ediff-merge-job nil)
(defmacro ediff-patch-job ()
'(eq ediff-job-name 'epatch))
@@ -293,18 +291,18 @@ It needs to be killed when we quit the session.")
'(ediff-merge-files-with-ancestor
ediff-merge-buffers-with-ancestor
ediff-merge-revisions-with-ancestor)))
-(ediff-defvar-local ediff-merge-with-ancestor-job nil "")
+(ediff-defvar-local ediff-merge-with-ancestor-job nil)
(defmacro ediff-3way-job ()
'(or ediff-3way-comparison-job ediff-merge-job))
-(ediff-defvar-local ediff-3way-job nil "")
+(ediff-defvar-local ediff-3way-job nil)
;; A diff3 job is like a 3way job, but ediff-merge doesn't require the use
;; of diff3.
(defmacro ediff-diff3-job ()
'(or ediff-3way-comparison-job
ediff-merge-with-ancestor-job))
-(ediff-defvar-local ediff-diff3-job nil "")
+(ediff-defvar-local ediff-diff3-job nil)
(defmacro ediff-windows-job ()
'(memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise)))
@@ -312,14 +310,14 @@ It needs to be killed when we quit the session.")
(defmacro ediff-word-mode-job ()
'(memq ediff-job-name '(ediff-windows-wordwise ediff-regions-wordwise)))
-(ediff-defvar-local ediff-word-mode-job nil "")
+(ediff-defvar-local ediff-word-mode-job nil)
(defmacro ediff-narrow-job ()
'(memq ediff-job-name '(ediff-windows-wordwise
ediff-regions-wordwise
ediff-windows-linewise
ediff-regions-linewise)))
-(ediff-defvar-local ediff-narrow-job nil "")
+(ediff-defvar-local ediff-narrow-job nil)
;; Note: ediff-merge-directory-revisions-with-ancestor is not treated as an
;; ancestor metajob, since it behaves differently.
@@ -405,7 +403,7 @@ It needs to be killed when we quit the session.")
(defcustom ediff-before-setup-hook nil
"Hooks to run before Ediff begins to set up windows and buffers.
This hook can be used to save the previous window config, which can be restored
-on ediff-quit or ediff-suspend."
+on `ediff-quit' or `ediff-suspend'."
:type 'hook
:group 'ediff-hook)
(defcustom ediff-before-setup-windows-hook nil
@@ -456,7 +454,7 @@ For each buffer, the hooks are run with that buffer made current."
"use `with-eval-after-load' instead." "28.1")
(defcustom ediff-mode-hook nil
- "Hook run just after ediff-mode is set up in the control buffer.
+ "Hook run just after `ediff-mode' is set up in the control buffer.
This is done before any windows or frames are created. One can use it to
set local variables that determine how the display looks like."
:type 'hook
@@ -492,11 +490,11 @@ set local variables that determine how the display looks like."
(defconst ediff-BAD-DIFF-NUMBER
;; %S stands for this-command, %d - diff number, %d - max diff
"%S: Bad diff region number, %d. Valid numbers are 1 to %d")
-(defconst ediff-BAD-INFO (format "
+(defconst ediff-BAD-INFO "
*** The Info file for Ediff, a part of the standard distribution
*** of Emacs, does not seem to be properly installed.
***
-*** Please contact your system administrator. "))
+*** Please contact your system administrator. ")
;; Selective browsing
@@ -516,25 +514,25 @@ See the documentation string of `ediff-hide-regexp-matches' for details.")
"Function to use in determining which regions to focus on.
See the documentation string of `ediff-focus-on-regexp-matches' for details.")
-;; Regexp that determines buf A regions to focus on when skipping to diff
-(ediff-defvar-local ediff-regexp-focus-A "" "")
-;; Regexp that determines buf B regions to focus on when skipping to diff
-(ediff-defvar-local ediff-regexp-focus-B "" "")
-;; Regexp that determines buf C regions to focus on when skipping to diff
-(ediff-defvar-local ediff-regexp-focus-C "" "")
+(ediff-defvar-local ediff-regexp-focus-A ""
+ "Regexp that determines buf A regions to focus on when skipping to diff.")
+(ediff-defvar-local ediff-regexp-focus-B ""
+ "Regexp that determines buf B regions to focus on when skipping to diff.")
+(ediff-defvar-local ediff-regexp-focus-C ""
+ "Regexp that determines buf C regions to focus on when skipping to diff.")
;; connective that determines whether to focus regions that match both or
;; one of the regexps
-(ediff-defvar-local ediff-focus-regexp-connective 'and "")
-
-;; Regexp that determines buf A regions to ignore when skipping to diff
-(ediff-defvar-local ediff-regexp-hide-A "" "")
-;; Regexp that determines buf B regions to ignore when skipping to diff
-(ediff-defvar-local ediff-regexp-hide-B "" "")
-;; Regexp that determines buf C regions to ignore when skipping to diff
-(ediff-defvar-local ediff-regexp-hide-C "" "")
+(ediff-defvar-local ediff-focus-regexp-connective 'and)
+
+(ediff-defvar-local ediff-regexp-hide-A ""
+ "Regexp that determines buf A regions to ignore when skipping to diff.")
+(ediff-defvar-local ediff-regexp-hide-B ""
+ "Regexp that determines buf B regions to ignore when skipping to diff.")
+(ediff-defvar-local ediff-regexp-hide-C ""
+ "Regexp that determines buf C regions to ignore when skipping to diff.")
;; connective that determines whether to hide regions that match both or
;; one of the regexps
-(ediff-defvar-local ediff-hide-regexp-connective 'and "")
+(ediff-defvar-local ediff-hide-regexp-connective 'and)
;;; Copying difference regions between buffers.
@@ -544,12 +542,12 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.")
;; from another buffer. This alist has the form:
;; \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...),
;; where some buffer-objects may be missing.
-(ediff-defvar-local ediff-killed-diffs-alist nil "")
+(ediff-defvar-local ediff-killed-diffs-alist nil)
;; Syntax table to use in ediff-forward-word-function
;; This is chosen by a heuristic. The important thing is for all buffers to
;; have the same syntax table. Which is not too important.
-(ediff-defvar-local ediff-syntax-table nil "")
+(ediff-defvar-local ediff-syntax-table nil)
;; Highlighting
@@ -589,25 +587,25 @@ highlighted using ASCII flags."
;; this indicates that diff regions are word-size, so fine diffs are
;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise
-(ediff-defvar-local ediff-word-mode nil "")
+(ediff-defvar-local ediff-word-mode nil)
;; Name of the job (ediff-files, ediff-windows, etc.)
-(ediff-defvar-local ediff-job-name nil "")
+(ediff-defvar-local ediff-job-name nil)
;; Narrowing and ediff-region/windows support
;; This is a list (overlay-A overlay-B overlay-C)
;; If set, Ediff compares only those parts of buffers A/B/C that lie within
;; the bounds of these overlays.
-(ediff-defvar-local ediff-narrow-bounds nil "")
+(ediff-defvar-local ediff-narrow-bounds nil)
;; List (overlay-A overlay-B overlay-C), where each overlay spans the
;; entire corresponding buffer.
-(ediff-defvar-local ediff-wide-bounds nil "")
+(ediff-defvar-local ediff-wide-bounds nil)
;; Current visibility boundaries in buffers A, B, and C.
;; This is also a list of overlays. When the user toggles narrow/widen,
;; this list changes from ediff-wide-bounds to ediff-narrow-bounds.
;; and back.
-(ediff-defvar-local ediff-visible-bounds nil "")
+(ediff-defvar-local ediff-visible-bounds nil)
(ediff-defvar-local ediff-start-narrowed t
"Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*")
@@ -616,7 +614,7 @@ highlighted using ASCII flags."
Actually, Ediff restores the scope of visibility that existed at startup.")
(defcustom ediff-keep-variants t
- "nil means prompt to remove unmodified buffers A/B/C at session end.
+ "Nil means prompt to remove unmodified buffers A/B/C at session end.
Supplying a prefix argument to the quit command `q' temporarily reverses the
meaning of this variable."
:type 'boolean
@@ -632,28 +630,28 @@ shown in brighter colors."
(put 'ediff-highlight-all-diffs 'permanent-local t)
-;; The suffix of the control buffer name.
-(ediff-defvar-local ediff-control-buffer-suffix nil "")
-;; Same as ediff-control-buffer-suffix, but without <,>.
-;; It's a number rather than string.
-(ediff-defvar-local ediff-control-buffer-number nil "")
+(ediff-defvar-local ediff-control-buffer-suffix nil
+ "The suffix of the control buffer name.")
+(ediff-defvar-local ediff-control-buffer-number nil
+ "Same as `ediff-control-buffer-suffix', but without \"<,>\".
+It's a number rather than string.")
-;; The original values of ediff-protected-variables for buffer A
-(ediff-defvar-local ediff-buffer-values-orig-A nil "")
-;; The original values of ediff-protected-variables for buffer B
-(ediff-defvar-local ediff-buffer-values-orig-B nil "")
-;; The original values of ediff-protected-variables for buffer C
-(ediff-defvar-local ediff-buffer-values-orig-C nil "")
-;; The original values of ediff-protected-variables for buffer Ancestor
-(ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "")
+(ediff-defvar-local ediff-buffer-values-orig-A nil
+ "The original values of ediff-protected-variables for buffer A.")
+(ediff-defvar-local ediff-buffer-values-orig-B nil
+ "The original values of ediff-protected-variables for buffer B.")
+(ediff-defvar-local ediff-buffer-values-orig-C nil
+ "The original values of ediff-protected-variables for buffer C.")
+(ediff-defvar-local ediff-buffer-values-orig-Ancestor nil
+ "The original values of ediff-protected-variables for buffer Ancestor.")
-;; association between buff-type and ediff-buffer-values-orig-*
(defconst ediff-buffer-values-orig-alist
'((A . ediff-buffer-values-orig-A)
(B . ediff-buffer-values-orig-B)
(C . ediff-buffer-values-orig-C)
- (Ancestor . ediff-buffer-values-orig-Ancestor)))
+ (Ancestor . ediff-buffer-values-orig-Ancestor))
+ "Association between buff-type and `ediff-buffer-values-orig-*'.")
;; Buffer-local variables to be saved then restored during Ediff sessions
(defconst ediff-protected-variables '(
@@ -666,37 +664,37 @@ shown in brighter colors."
;; indicates the way a diff region was created in buffer C.
;; state-of-ancestor says if the corresponding region in ancestor buffer is
;; empty.
-(ediff-defvar-local ediff-state-of-merge nil "")
-
-;; The difference that is currently selected.
-(ediff-defvar-local ediff-current-difference -1 "")
-;; Number of differences found.
-(ediff-defvar-local ediff-number-of-differences nil "")
-
-;; Buffer containing the output of diff, which is used by Ediff to step
-;; through files.
-(ediff-defvar-local ediff-diff-buffer nil "")
-;; Like ediff-diff-buffer, but contains context diff. It is not used by
-;; Ediff, but it is saved in a file, if user requests so.
-(ediff-defvar-local ediff-custom-diff-buffer nil "")
-;; Buffer used for diff-style fine differences between regions.
-(ediff-defvar-local ediff-fine-diff-buffer nil "")
-;; Temporary buffer used for computing fine differences.
-(defconst ediff-tmp-buffer " *ediff-tmp*" "")
-;; Buffer used for messages
-(defconst ediff-msg-buffer " *ediff-message*" "")
-;; Buffer containing the output of diff when diff returns errors.
-(ediff-defvar-local ediff-error-buffer nil "")
-;; Buffer to display debug info
-(ediff-defvar-local ediff-debug-buffer "*ediff-debug*" "")
-
-;; List of ediff control panels associated with each buffer A/B/C/Ancestor.
-;; Not used any more, but may be needed in the future.
-(ediff-defvar-local ediff-this-buffer-ediff-sessions nil "")
+(ediff-defvar-local ediff-state-of-merge nil)
+
+(ediff-defvar-local ediff-current-difference -1
+ "The difference that is currently selected.")
+(ediff-defvar-local ediff-number-of-differences nil
+ "Number of differences found.")
+
+(ediff-defvar-local ediff-diff-buffer nil
+ "Buffer containing the output of diff, which is used to step through files.")
+(ediff-defvar-local ediff-custom-diff-buffer nil
+ "Like `ediff-diff-buffer', but contains context diff.
+It is not used by Ediff, but it is saved in a file, if user
+requests so.")
+(ediff-defvar-local ediff-fine-diff-buffer nil
+ "Buffer used for diff-style fine differences between regions.")
+(defconst ediff-tmp-buffer " *ediff-tmp*"
+ "Temporary buffer used for computing fine differences.")
+(defconst ediff-msg-buffer " *ediff-message*"
+ "Buffer used for messages.")
+(ediff-defvar-local ediff-error-buffer nil
+ "Buffer containing the output of diff when diff returns errors.")
+(ediff-defvar-local ediff-debug-buffer "*ediff-debug*"
+ "Buffer to display debug info.")
+
+(ediff-defvar-local ediff-this-buffer-ediff-sessions nil
+ "List of ediff control panels associated with each buffer A/B/C/Ancestor.
+Not used any more, but may be needed in the future.")
;; to be deleted in due time
;; List of difference overlays disturbed by working with the current diff.
-(defvar ediff-disturbed-overlays nil "")
+(defvar ediff-disturbed-overlays nil)
(defcustom ediff-version-control-package 'vc
"Version control package used.
@@ -708,7 +706,7 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire."
:group 'ediff)
(defcustom ediff-coding-system-for-read 'raw-text
- "The coding system for read to use when running the diff program as a subprocess.
+ "Coding system for read to use when running the diff program as a subprocess.
In most cases, the default will do. However, under certain circumstances in
MS-Windows you might need to use something like `raw-text-dos' here.
So, if the output that your diff program sends to Emacs contains extra ^M's,
@@ -718,8 +716,9 @@ work."
:group 'ediff)
(defcustom ediff-coding-system-for-write 'emacs-internal
- "The coding system for write to use when writing out difference regions
-to temp files in buffer jobs and when Ediff needs to find fine differences."
+ "Coding system for write to use when writing out difference regions.
+This is used when writing to temp files in buffer jobs and when
+Ediff needs to find fine differences."
:type 'symbol
:group 'ediff)
@@ -739,8 +738,7 @@ to temp files in buffer jobs and when Ediff needs to find fine differences."
;; in effect for this buffer: `face', `ascii',
;; `off' -- turned off (on a dumb terminal only).
(ediff-defvar-local ediff-highlighting-style
- (if (and (ediff-has-face-support-p) ediff-use-faces) 'face 'ascii)
- "")
+ (if (and (ediff-has-face-support-p) ediff-use-faces) 'face 'ascii))
(define-obsolete-function-alias 'ediff-display-pixel-width
@@ -790,7 +788,7 @@ to temp files in buffer jobs and when Ediff needs to find fine differences."
(defun ediff-set-face-pixmap (face pixmap)
- "Set face pixmap on a monochrome display."
+ "Set stipple pixmap of FACE to PIXMAP on a monochrome display."
(if (and (ediff-window-display-p) (not (display-color-p)))
(condition-case nil
(set-face-background-pixmap face pixmap)
@@ -836,7 +834,7 @@ this variable represents.")
;; this variable is set to nil, then again to the appropriate face.
(defvar ediff-current-diff-face-B 'ediff-current-diff-B
"Face for highlighting the selected difference in buffer B.
- this variable. Instead, use the customization
+DO NOT CHANGE this variable. Instead, use the customization
widget to customize the actual face `ediff-current-diff-B'
this variable represents.")
@@ -1221,7 +1219,7 @@ This property can be toggled interactively."
;; Store orig value of `ediff-show-ancestor' when changed in
;; `ediff-toggle-show-ancestor' and restore it on exit.
-(ediff-defvar-local ediff--show-ancestor-orig nil "")
+(ediff-defvar-local ediff--show-ancestor-orig nil)
(defcustom ediff-autostore-merges 'group-jobs-only
"Save the results of merge jobs automatically.
@@ -1233,8 +1231,8 @@ or `ediff-merge-directory-revisions'."
:group 'ediff-merge)
(make-variable-buffer-local 'ediff-autostore-merges)
-;; file where the result of the merge is to be saved. used internally
-(ediff-defvar-local ediff-merge-store-file nil "")
+(ediff-defvar-local ediff-merge-store-file nil
+ "File where the result of the merge is to be saved. Internal.")
(defcustom ediff-merge-filename-prefix "merge_"
"Prefix to be attached to saved merge buffers."
@@ -1267,12 +1265,12 @@ This default should work without changes."
(make-obsolete-variable 'ediff-H-glyph nil "28.1")
-;; Temporary file used for refining difference regions in buffer A.
-(ediff-defvar-local ediff-temp-file-A nil "")
-;; Temporary file used for refining difference regions in buffer B.
-(ediff-defvar-local ediff-temp-file-B nil "")
-;; Temporary file used for refining difference regions in buffer C.
-(ediff-defvar-local ediff-temp-file-C nil "")
+(ediff-defvar-local ediff-temp-file-A nil
+ "Temporary file used for refining difference regions in buffer A.")
+(ediff-defvar-local ediff-temp-file-B nil
+ "Temporary file used for refining difference regions in buffer B.")
+(ediff-defvar-local ediff-temp-file-C nil
+ "Temporary file used for refining difference regions in buffer C.")
(defun ediff-file-remote-p (file-name)
@@ -1474,7 +1472,7 @@ This default should work without changes."
(delete-overlay overlay)))))
(defun ediff-overlay-put (overlay prop value)
- "Calls `overlay-put', but checks if overlay's buffer exists."
+ "Call `overlay-put', but check if OVERLAY's buffer exists."
(if (ediff-buffer-live-p (overlay-buffer overlay))
(overlay-put overlay prop value)
(delete-overlay overlay)))
diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el
index ad4ef473f84..d0ce9d326d8 100644
--- a/lisp/vc/ediff-merg.el
+++ b/lisp/vc/ediff-merg.el
@@ -53,7 +53,7 @@ Valid values are the symbols `default-A', `default-B', and `combined'."
"Pattern to be used for combining difference regions in buffers A and B.
The value must be a list of the form
\(STRING1 bufspec1 STRING2 bufspec2 STRING3 bufspec3 STRING4)
-where bufspec is the symbol A, B, or Ancestor. For instance, if the value is
+where bufspec is the symbol A, B, or Ancestor. For instance, if the value is
'(STRING1 A STRING2 Ancestor STRING3 B STRING4) then the
combined text will look like this:
@@ -63,8 +63,7 @@ STRING2
diff region from the ancestor
STRING3
diff region from variant B
-STRING4
-"
+STRING4"
:type '(choice (list string symbol string symbol string)
(list string symbol string symbol string symbol string))
:group 'ediff-merge)
@@ -258,7 +257,8 @@ Buffer B."
(defun ediff-re-merge ()
- "Remerge unmodified diff regions using a new default. Start with the current region."
+ "Remerge unmodified diff regions using a new default.
+Start with the current region."
(interactive)
(let* ((default-variant-alist
(list '("default-A") '("default-B") '("combined")))
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index 8e88b60a0bd..bec0ec01208 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -47,7 +47,7 @@
;; explanation of the two nil placeholders in such elements.
;;
;; There is API for extracting the components of the members of the
-;; above list. Search for `API for ediff-meta-list' for details.
+;; above list. Search for `API for ediff-meta-list' for details.
;;
;; HEADER must be a list of SIX elements (nil or string):
;; (regexp metaobj1 metaobj2 metaobj3 merge-save-buffer
@@ -114,8 +114,8 @@
(require 'ediff-util)
;; meta-buffer
-(ediff-defvar-local ediff-meta-buffer nil "")
-(ediff-defvar-local ediff-parent-meta-buffer nil "")
+(ediff-defvar-local ediff-meta-buffer nil)
+(ediff-defvar-local ediff-parent-meta-buffer nil)
;; the registry buffer
(defvar ediff-registry-buffer nil)
@@ -157,28 +157,27 @@ Useful commands (type ? to hide them and free up screen):
(define-key map [delete] #'previous-line)
(define-key map [backspace] #'previous-line)
map)
- "The keymap to be installed in the buffer showing differences between
-directories.")
+ "Keymap for buffer showing differences between directories.")
;; Variable specifying the action to take when the use invokes ediff in the
;; meta buffer. This is usually ediff-registry-action or ediff-filegroup-action
-(ediff-defvar-local ediff-meta-action-function nil "")
+(ediff-defvar-local ediff-meta-action-function nil)
;; Tells ediff-update-meta-buffer how to redraw it
-(ediff-defvar-local ediff-meta-redraw-function nil "")
+(ediff-defvar-local ediff-meta-redraw-function nil)
;; Tells ediff-filegroup-action and similar procedures how to invoke Ediff for
;; the sessions in a given session group
-(ediff-defvar-local ediff-session-action-function nil "")
+(ediff-defvar-local ediff-session-action-function nil)
-(ediff-defvar-local ediff-metajob-name nil "")
+(ediff-defvar-local ediff-metajob-name nil)
;; buffer used to collect custom diffs from individual sessions in the group
-(ediff-defvar-local ediff-meta-diff-buffer nil "")
+(ediff-defvar-local ediff-meta-diff-buffer nil)
;; t means recurse into subdirs when deciding which files have same contents
-(ediff-defvar-local ediff-recurse-to-subdirectories nil "")
+(ediff-defvar-local ediff-recurse-to-subdirectories nil)
;; history var to use for filtering groups of files
-(defvar ediff-filtering-regexp-history nil "")
+(defvar ediff-filtering-regexp-history nil)
(defcustom ediff-default-filtering-regexp nil
"Default regular expression used as a filename filter in multifile comparisons.
@@ -195,14 +194,14 @@ Should be a sexp. For instance (car ediff-filtering-regexp-history) or nil."
;; buffer, this means ediff is still working on the pair.
;; Eq-status of a file is t if the file equals some other file in the same
;; group.
-(ediff-defvar-local ediff-meta-list nil "")
+(ediff-defvar-local ediff-meta-list nil)
-(ediff-defvar-local ediff-meta-session-number nil "")
+(ediff-defvar-local ediff-meta-session-number nil)
;; the difference list between directories in a directory session group
-(ediff-defvar-local ediff-dir-difference-list nil "")
-(ediff-defvar-local ediff-dir-diffs-buffer nil "")
+(ediff-defvar-local ediff-dir-difference-list nil)
+(ediff-defvar-local ediff-dir-diffs-buffer nil)
;; The registry of Ediff sessions. A list of control buffers.
(defvar ediff-session-registry nil)
@@ -233,8 +232,8 @@ on `ediff-quit', `ediff-suspend', or `ediff-quit-session-group-hook'."
(make-obsolete-variable 'ediff-before-session-group-setup-hooks nil "27.1")
(defcustom ediff-after-session-group-setup-hook nil
- "Hooks run just after a meta-buffer controlling a session group, such as
-ediff-directories, is run."
+ "Hooks run just after a meta-buffer controlling a session group is run.
+One example of this is `ediff-directories'."
:type 'hook)
(defcustom ediff-quit-session-group-hook nil
"Hooks run just before exiting a session group."
@@ -252,8 +251,8 @@ This means that you can set different bindings for different kinds of meta
buffers."
:type 'hook)
-;; Buffer holding the multi-file patch. Local to the meta buffer
-(ediff-defvar-local ediff-meta-patchbufer nil "")
+(ediff-defvar-local ediff-meta-patchbufer nil
+ "Buffer holding the multi-file patch. Local to the meta buffer.")
;;; API for ediff-meta-list
@@ -367,8 +366,8 @@ buffers."
(ediff-defvar-local ediff-verbose-help-enabled nil
- "If t, display redundant help in ediff-directories and other meta buffers.
-Toggled by ediff-toggle-verbose-help-meta-buffer" )
+ "If t, display redundant help in `ediff-directories' and other meta buffers.
+Toggled by `ediff-toggle-verbose-help-meta-buffer'.")
;; Toggle verbose help in meta-buffers
;; TODO: Someone who understands all this can make it better.
@@ -460,7 +459,9 @@ Commands:
(defun ediff-next-meta-item (count)
"Move to the next item in Ediff registry or session group buffer.
-Moves in circular fashion. With numeric prefix arg, skip this many items."
+Moves in circular fashion.
+
+With numeric prefix arg COUNT, skip this many items."
(interactive "p")
(or count (setq count 1))
(let (overl)
@@ -488,7 +489,9 @@ Moves in circular fashion. With numeric prefix arg, skip this many items."
(defun ediff-previous-meta-item (count)
"Move to the previous item in Ediff registry or session group buffer.
-Moves in circular fashion. With numeric prefix arg, skip this many items."
+Moves in circular fashion.
+
+With numeric prefix arg COUNT, skip this many items."
(interactive "p")
(or count (setq count 1))
(let (overl)
@@ -611,22 +614,22 @@ behavior."
(if (ediff-nonempty-string-p merge-autostore-dir)
(setq merge-autostore-dir
(file-name-as-directory merge-autostore-dir)))
- (setq common (ediff-intersection lis1 lis2 #'string=))
+ (setq common (seq-intersection lis1 lis2 #'string=))
;; In merge with ancestor jobs, we don't intersect with lis3.
;; If there is no ancestor, we'll offer to merge without the ancestor.
;; So, we intersect with lis3 only when we are doing 3-way file comparison
(if (and lis3 (ediff-comparison-metajob3 jobname))
- (setq common (ediff-intersection common lis3 #'string=)))
+ (setq common (seq-intersection common lis3 #'string=)))
;; copying is needed because sort sorts via side effects
(setq common (sort (copy-sequence common) #'string-lessp))
;; compute difference list
- (setq difflist (ediff-set-difference
- (ediff-union (ediff-union lis1 lis2 #'string=)
- lis3
- #'string=)
+ (setq difflist (seq-difference
+ (seq-union (seq-union lis1 lis2 #'string=)
+ lis3
+ #'string=)
common
#'string=)
difflist (delete "." difflist)
@@ -1531,7 +1534,9 @@ Useful commands:
(ediff-overlay-put overl 'ediff-meta-session-number session-number))))
(defun ediff-mark-for-hiding-at-pos (unmark)
- "Mark session for hiding. With prefix arg, unmark."
+ "Mark session for hiding.
+
+With prefix arg UNMARK, unmark instead."
(interactive "P")
(let* ((pos (ediff-event-point last-command-event))
(meta-buf (ediff-event-buffer last-command-event))
@@ -1541,10 +1546,9 @@ Useful commands:
(ediff-mark-session-for-hiding info unmark)
(ediff-next-meta-item 1)
(save-excursion
- (ediff-update-meta-buffer meta-buf nil session-number))
- ))
+ (ediff-update-meta-buffer meta-buf nil session-number))))
-;; Returns whether session was marked or unmarked
+;; Return whether session was marked or unmarked.
(defun ediff-mark-session-for-hiding (info unmark)
(let (ignore)
(cond ((eq unmark 'mark) (setq unmark nil))
@@ -1560,7 +1564,9 @@ Useful commands:
(defun ediff-mark-for-operation-at-pos (unmark)
- "Mark session for a group operation. With prefix arg, unmark."
+ "Mark session for a group operation.
+
+With prefix arg UNMARK, unmark instead."
(interactive "P")
(let* ((pos (ediff-event-point last-command-event))
(meta-buf (ediff-event-buffer last-command-event))
@@ -1589,7 +1595,9 @@ Useful commands:
(defun ediff-hide-marked-sessions (unhide)
- "Hide marked sessions. With prefix arg, unhide."
+ "Hide marked sessions.
+
+With prefix arg UNHIDE, unhide instead."
(interactive "P")
(let ((grp-buf (ediff-get-group-buffer ediff-meta-list))
(meta-list (cdr ediff-meta-list))
@@ -1669,7 +1677,7 @@ Useful commands:
(setq custom-diff-buf ediff-custom-diff-buffer)))))
(or (ediff-buffer-live-p meta-diff-buff)
- (user-error "Ediff: something wrong--killed multiple diff's buffer"))
+ (user-error "Ediff: Something wrong--killed multiple diff's buffer"))
(cond ((ediff-buffer-live-p custom-diff-buf)
;; for live session buffers we do them first because the user may
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index d52910efceb..7622cf4c196 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -128,18 +128,19 @@ You probably don't want to change that, unless you are using an obscure patch
program."
:type 'regexp)
-;; The buffer of the patch file. Local to control buffer.
-(ediff-defvar-local ediff-patchbufer nil "")
+(ediff-defvar-local ediff-patchbufer nil
+ "The buffer of the patch file. Local to control buffer.")
-;; The buffer where patch displays its diagnostics.
-(ediff-defvar-local ediff-patch-diagnostics nil "")
+(ediff-defvar-local ediff-patch-diagnostics nil
+ "The buffer where patch displays its diagnostics.")
-;; Map of patch buffer. Has the form:
-;; ((filename1 marker1 marker2) (filename2 marker1 marker2) ...)
-;; where filenames are files to which patch would have applied the patch;
-;; marker1 delimits the beginning of the corresponding patch and marker2 does
-;; it for the end.
-(ediff-defvar-local ediff-patch-map nil "")
+(ediff-defvar-local ediff-patch-map nil
+ "Map of patch buffer.
+Has the form:
+ ((filename1 marker1 marker2) (filename2 marker1 marker2) ...)
+where filenames are files to which patch would have applied the patch;
+marker1 delimits the beginning of the corresponding patch and marker2 does
+it for the end.")
;; strip prefix from filename
;; returns /dev/null, if can't strip prefix
@@ -502,15 +503,11 @@ are two possible targets for this %spatch. However, these files do not exist."
patch-file-name)
(setq patch-file-name
(read-file-name
- (format "Patch is in file%s: "
- (cond ((and buffer-file-name
- (equal (expand-file-name dir)
- (file-name-directory buffer-file-name)))
- (concat
- " (default "
- (file-name-nondirectory buffer-file-name)
- ")"))
- (t "")))
+ (format-prompt "Patch is in file"
+ (and buffer-file-name
+ (equal (expand-file-name dir)
+ (file-name-directory buffer-file-name))
+ (file-name-nondirectory buffer-file-name)))
dir buffer-file-name 'must-match))
(if (file-directory-p patch-file-name)
(error "Patch file cannot be a directory: %s" patch-file-name)
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index 0cbea2c28d7..d4660a179e6 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -87,12 +87,10 @@ Commands:
(kill-all-local-variables)
(setq major-mode 'ediff-mode)
(setq mode-name "Ediff")
- ;; We use run-hooks instead of run-mode-hooks for two reasons.
+ ;; We use run-hooks instead of run-mode-hooks for one reason.
;; The ediff control buffer is read-only and it is not supposed to be
;; modified by minor modes and such. So, run-mode-hooks doesn't do anything
;; useful here on top of what run-hooks does.
- ;; Second, changing run-hooks to run-mode-hooks would require an
- ;; if-statement, since XEmacs doesn't have this.
(run-hooks 'ediff-mode-hook))
@@ -515,7 +513,7 @@ to invocation.")
;; This function assumes that we are in the window where control buffer is
;; to reside.
(defun ediff-setup-control-buffer (ctl-buf)
- "Set up window for control buffer."
+ "Set up window for control buffer CTL-BUF."
(if (window-dedicated-p)
(set-buffer ctl-buf) ; we are in control frame but just in case
(switch-to-buffer ctl-buf))
@@ -663,7 +661,7 @@ if necessary."
(message "")
))
-;; Not bound to any key---to dangerous. A user can do it if necessary.
+;; Not bound to any key---too dangerous. A user can do it if necessary.
(defun ediff-revert-buffers-then-recompute-diffs (noconfirm)
"Revert buffers A, B and C. Then rerun Ediff on file A and file B."
(interactive "P")
@@ -698,11 +696,12 @@ if necessary."
(ediff-merge-buffers bufA bufB)))
(ediff-update-diffs))))
-
-;; optional NO-REHIGHLIGHT says to not rehighlight buffers
(defun ediff-recenter (&optional no-rehighlight)
"Bring the highlighted region of all buffers being compared into view.
-Reestablish the default window display."
+Reestablish the default window display.
+
+If optional NO-REHIGHLIGHT is non-nil, do not rehighlight
+buffers."
(interactive)
(ediff-barf-if-not-control-buffer)
(let (buffer-read-only)
@@ -967,7 +966,7 @@ Please report this bug to bug-gnu-emacs@gnu.org")
(message "Showing ancestor buffer")))
(defun ediff-make-or-kill-fine-diffs (arg)
- "Compute fine diffs. With negative prefix arg, kill fine diffs.
+ "Compute fine diffs. With negative prefix ARG, kill fine diffs.
In both cases, operates on the current difference region."
(interactive "P")
(ediff-barf-if-not-control-buffer)
@@ -1331,7 +1330,7 @@ To change the default, set the variable `ediff-use-toolbar-p', which see."
;; Merging
(defun ediff-toggle-show-clashes-only ()
- "Toggle the mode that shows only the merge regions where both variants differ from the ancestor."
+ "Toggle mode showing only merge regions where both variants differ from ancestor."
(interactive)
(ediff-barf-if-not-control-buffer)
(if (not ediff-merge-with-ancestor-job)
@@ -1512,7 +1511,7 @@ the one half of the height of window-A."
(defun ediff-scroll-horizontally (&optional arg)
"Horizontally scroll buffers A, B (and C if appropriate).
-If an argument is given, that is how many columns are scrolled, else nearly
+With prefix argument ARG, scroll that many columns, else nearly
the width of the A/B/C windows."
(interactive "P")
(ediff-barf-if-not-control-buffer)
@@ -1680,7 +1679,7 @@ the width of the A/B/C windows."
(defun ediff-next-difference (&optional arg)
"Advance to the next difference.
-With a prefix argument, go forward that many differences."
+With a prefix argument ARG, go forward that many differences."
(interactive "p")
(ediff-barf-if-not-control-buffer)
(if (< ediff-current-difference ediff-number-of-differences)
@@ -1731,7 +1730,7 @@ With a prefix argument, go forward that many differences."
(defun ediff-previous-difference (&optional arg)
"Go to the previous difference.
-With a prefix argument, go back that many differences."
+With a prefix argument ARG, go back that many differences."
(interactive "p")
(ediff-barf-if-not-control-buffer)
(if (> ediff-current-difference -1)
@@ -1781,8 +1780,9 @@ With a prefix argument, go back that many differences."
;; The diff number is as perceived by the user (i.e., 1+ the internal
;; representation)
(defun ediff-jump-to-difference (difference-number)
- "Go to the difference specified as a prefix argument.
-If the prefix is negative, count differences from the end."
+ "Go to the difference specified as a prefix argument DIFFERENCE-NUMBER.
+If the prefix argument is negative, count differences from the
+end."
(interactive "p")
(ediff-barf-if-not-control-buffer)
(setq difference-number
@@ -1803,8 +1803,9 @@ If the prefix is negative, count differences from the end."
The buffer depends on last command character \(a, b, or c) that invoked this
command. For instance, if the command was `ga' then the point value in buffer
A is used.
-With a prefix argument, synchronize all files around the current point position
-in the specified buffer."
+
+With a prefix argument ARG, synchronize all files around the
+current point position in the specified buffer."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(let* ((buf-type (ediff-char-to-buftype last-command-event))
@@ -1900,15 +1901,17 @@ in the specified buffer."
(defun ediff-diff-to-diff (arg &optional keys)
"Copy buffer-X'th difference region to buffer Y (X,Y are A, B, or C).
-If numerical prefix argument, copy the difference specified in the arg.
+With numerical prefix argument ARG, copy the difference specified
+in the arg.
Otherwise, copy the difference given by `ediff-current-difference'.
This command assumes it is bound to a 2-character key sequence, `ab', `ba',
`ac', etc., which is used to determine the types of buffers to be used for
copying difference regions. The first character in the sequence specifies
the source buffer and the second specifies the target.
-If the second optional argument, a 2-character string, is given, use it to
-determine the source and the target buffers instead of the command keys."
+If optional argument KEYS, a 2-character string, is given, use it
+to determine the source and the target buffers instead of the
+command keys."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(or keys (setq keys (this-command-keys)))
@@ -2139,8 +2142,9 @@ ARG is a prefix argument. If nil, copy the current difference region."
(defun ediff-restore-diff (arg &optional key)
"Restore ARGth diff from `ediff-killed-diffs-alist'.
ARG is a prefix argument. If ARG is nil, restore the current-difference.
-If the second optional argument, a character, is given, use it to
-determine the target buffer instead of `ediff-last-command-char'."
+If the second optional argument KEY, a character, is given, use
+it to determine the target buffer instead of
+`ediff-last-command-char'."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(if (numberp arg)
@@ -2159,8 +2163,8 @@ ARG is a prefix argument. If nil, restore the current diff."
(defun ediff-toggle-regexp-match ()
- "Toggle between focusing and hiding of difference regions that match
-a regular expression typed in by the user."
+ "Toggle between focusing and hiding difference regions matching a regexp.
+Prompt the user for regular expression."
(interactive)
(ediff-barf-if-not-control-buffer)
(let ((regexp-A "")
@@ -2360,9 +2364,11 @@ flags of the compared file buffers, kills Ediff buffers for this session
\(but not buffers A, B, C).
If `ediff-keep-variants' is nil, the user will be asked whether the buffers
-containing the variants should be removed \(if they haven't been modified).
-If it is t, they will be preserved unconditionally. A prefix argument,
-temporarily reverses the meaning of this variable."
+containing the variants should be removed (if they haven't been modified).
+If it is t, they will be preserved unconditionally.
+
+With prefix argument REVERSE-DEFAULT-KEEP-VARIANTS, temporarily
+reverse the meaning of this variable."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(let ((ctl-buf (current-buffer))
@@ -2771,8 +2777,8 @@ up an appropriate window config."
(interactive)
(ediff-barf-if-not-control-buffer)
(run-hooks 'ediff-suspend-hook)
- (message
- "To resume, type M-x eregistry and select the desired Ediff session"))
+ (message (substitute-command-keys
+ "To resume, type \\[eregistry] and select the desired Ediff session")))
;; ediff-barf-if-not-control-buffer ensures only called from ediff.
(declare-function ediff-version "ediff" ())
@@ -3097,11 +3103,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
(lambda () (when defaults
(setq minibuffer-default defaults)))
(read-file-name
- (format "%s%s "
- prompt
- (cond (default-file
- (concat " (default " default-file "):"))
- (t (concat " (default " default-dir "):"))))
+ (format-prompt prompt (or default-file default-dir))
default-dir
(or default-file default-dir)
t ; must match, no-confirm
@@ -3214,7 +3216,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
(if (buffer-modified-p)
;; If buffer is not obsolete and is modified, offer to save
(if (yes-or-no-p
- (format "Buffer %s has been modified. Save it in file %s? "
+ (format "Buffer %s has been modified. Save it in file %s?"
(buffer-name)
buffer-file-name))
(condition-case nil
@@ -3271,7 +3273,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
`wa' saves buffer A, `wb' saves buffer B, `wc' saves buffer C,
and `wd' saves the diff output.
-With prefix argument, `wd' saves plain diff output.
+With prefix argument ARG, `wd' saves plain diff output.
Without an argument, it saves customized diff argument, if available
\(and plain output, if customized output was not generated)."
(interactive "P")
@@ -3938,8 +3940,8 @@ If Emacs happens to dump core, this is NOT an Ediff problem---it is
an Emacs bug. Report this to Emacs maintainers.
Another popular topic for reports is compilation messages. Because Ediff
-interfaces to several other packages and runs under Emacs and XEmacs,
-byte-compilation may produce output like this:
+interfaces to several other packages, byte-compilation may produce output
+like this:
While compiling toplevel forms in file ediff.el:
** reference to free variable zzz
@@ -4068,7 +4070,7 @@ Mail anyway? (y or n) ")
;;; Debug
-(ediff-defvar-local ediff-command-begin-time '(0 0 0) "")
+(ediff-defvar-local ediff-command-begin-time '(0 0 0))
;; calculate time used by command
(defun ediff-calc-command-time ()
@@ -4139,6 +4141,7 @@ Mail anyway? (y or n) ")
;; this uses comparison-func to decide who is a member
(defun ediff-member (elt lis comparison-func)
+ (declare (obsolete seq-contains-p "28.1"))
(while (and lis (not (funcall comparison-func (car lis) elt)))
(setq lis (cdr lis)))
lis)
@@ -4153,42 +4156,11 @@ Mail anyway? (y or n) ")
(key-description desc)
(format "M-x %s" func-def))))
-;; this uses comparison-func to decide who is a member, and this determines how
-;; intersection looks like
-(defun ediff-intersection (lis1 lis2 comparison-func)
- (let ((result (list 'a)))
- (while lis1
- (if (ediff-member (car lis1) lis2 comparison-func)
- (nconc result (list (car lis1))))
- (setq lis1 (cdr lis1)))
- (cdr result)))
-
-
-;; eliminates duplicates using comparison-func
-(defun ediff-union (lis1 lis2 comparison-func)
- (let ((result (list 'a)))
- (while lis1
- (or (ediff-member (car lis1) (cdr result) comparison-func)
- (nconc result (list (car lis1))))
- (setq lis1 (cdr lis1)))
- (while lis2
- (or (ediff-member (car lis2) (cdr result) comparison-func)
- (nconc result (list (car lis2))))
- (setq lis2 (cdr lis2)))
- (cdr result)))
-
-;; eliminates duplicates using comparison-func
-(defun ediff-set-difference (lis1 lis2 comparison-func)
- (let ((result (list 'a)))
- (while lis1
- (or (ediff-member (car lis1) (cdr result) comparison-func)
- (ediff-member (car lis1) lis2 comparison-func)
- (nconc result (list (car lis1))))
- (setq lis1 (cdr lis1)))
- (cdr result)))
-
(define-obsolete-function-alias 'ediff-add-to-history #'add-to-history "27.1")
(define-obsolete-function-alias 'ediff-copy-list #'copy-sequence "28.1")
+(define-obsolete-function-alias 'ediff-union #'seq-union "28.1")
+(define-obsolete-function-alias 'ediff-intersection #'seq-intersection "28.1")
+(define-obsolete-function-alias 'ediff-set-difference #'seq-difference "28.1")
(run-hooks 'ediff-load-hook)
diff --git a/lisp/vc/ediff-vers.el b/lisp/vc/ediff-vers.el
index 9e82392725d..0646ba3cc20 100644
--- a/lisp/vc/ediff-vers.el
+++ b/lisp/vc/ediff-vers.el
@@ -88,8 +88,8 @@ comparison or merge operations are being performed."
;; RCS.el support
(defun rcs-ediff-view-revision (&optional rev)
-;; View previous RCS revision of current file.
-;; With prefix argument, prompts for a revision name.
+ "View previous RCS revision of current file.
+With prefix argument, prompts for a revision name."
(interactive (list (if current-prefix-arg
(read-string "Revision: "))))
(let* ((filename (buffer-file-name (current-buffer)))
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index fc6ea944ae1..bc6aa288508 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -89,25 +89,25 @@ provided functions are written."
(function :tag "Other function"))
:version "24.3")
-;; indicates if we are in a multiframe setup
-(ediff-defvar-local ediff-multiframe nil "")
-
-;; Share of the frame occupied by the merge window (buffer C)
-(ediff-defvar-local ediff-merge-window-share 0.45 "")
-
-;; The control window.
-(ediff-defvar-local ediff-control-window nil "")
-;; Official window for buffer A
-(ediff-defvar-local ediff-window-A nil "")
-;; Official window for buffer B
-(ediff-defvar-local ediff-window-B nil "")
-;; Official window for buffer C
-(ediff-defvar-local ediff-window-C nil "")
-;; Official window for buffer Ancestor
-(ediff-defvar-local ediff-window-Ancestor nil "")
-;; Ediff's window configuration.
-;; Used to minimize the need to rearrange windows.
-(ediff-defvar-local ediff-window-config-saved "" "")
+(ediff-defvar-local ediff-multiframe nil
+ "Indicates if we are in a multiframe setup.")
+
+(ediff-defvar-local ediff-merge-window-share 0.45
+ "Share of the frame occupied by the merge window (buffer C).")
+
+(ediff-defvar-local ediff-control-window nil
+ "The control window.")
+(ediff-defvar-local ediff-window-A nil
+ "Official window for buffer A.")
+(ediff-defvar-local ediff-window-B nil
+ "Official window for buffer B.")
+(ediff-defvar-local ediff-window-C nil
+ "Official window for buffer C.")
+(ediff-defvar-local ediff-window-Ancestor nil
+ "Official window for buffer Ancestor.")
+(ediff-defvar-local ediff-window-config-saved ""
+ "Ediff's window configuration.
+Used to minimize the need to rearrange windows.")
;; Association between buff-type and ediff-window-*
(defconst ediff-window-alist
@@ -176,9 +176,9 @@ In this case, Ediff will use those frames to display these buffers."
"Frame parameters for displaying Ediff Control Panel.
Used internally---not a user option.")
-;; position of the mouse; used to decide whether to warp the mouse into ctl
-;; frame
-(ediff-defvar-local ediff-mouse-pixel-position nil "")
+(ediff-defvar-local ediff-mouse-pixel-position nil
+ "Position of the mouse.
+Used to decide whether to warp the mouse into control frame.")
;; not used for now
(defvar ediff-mouse-pixel-threshold 30
@@ -227,12 +227,10 @@ customization of the default."
;; Wide frame display
-;; t means Ediff is using wide display
-(ediff-defvar-local ediff-wide-display-p nil "")
-;; keeps frame config for toggling wide display
+(ediff-defvar-local ediff-wide-display-p nil
+ "If t, Ediff is using wide display.")
(ediff-defvar-local ediff-wide-display-orig-parameters nil
- "Frame parameters to be restored when the user wants to toggle the wide
-display off.")
+ "Frame parameters to restore when toggling the wide display off.")
(ediff-defvar-local ediff-wide-display-frame nil
"Frame to be used for wide display.")
(ediff-defvar-local ediff-make-wide-display-function #'ediff-make-wide-display
@@ -243,8 +241,8 @@ frame parameters in `ediff-wide-display-orig-parameters'.
The variable `ediff-wide-display-frame' should be set to contain
the frame used for the wide display.")
-;; Frame used for the control panel in a windowing system.
-(ediff-defvar-local ediff-control-frame nil "")
+(ediff-defvar-local ediff-control-frame nil
+ "Frame used for the control panel in a windowing system.")
(defcustom ediff-prefer-iconified-control-frame nil
"If t, keep control panel iconified when help message is off.
@@ -400,7 +398,8 @@ keyboard input to go into icons."
;; skip dedicated and unsplittable frames
(ediff-destroy-control-frame control-buffer)
(let ((window-min-height 1)
- split-window-function wind-width-or-height
+ (window-combination-resize t)
+ split-window-function
three-way-comparison
wind-A-start wind-B-start wind-A wind-B wind-C)
(with-current-buffer control-buffer
@@ -419,22 +418,12 @@ keyboard input to go into icons."
(select-window (next-window nil 'ignore-minibuf)))
(delete-other-windows)
(set-window-dedicated-p (selected-window) nil)
- (split-window-vertically)
- (ediff-select-lowest-window)
- (ediff-setup-control-buffer control-buffer)
;; go to the upper window and split it betw A, B, and possibly C
(other-window 1)
(switch-to-buffer buf-A)
(setq wind-A (selected-window))
- (if three-way-comparison
- (setq wind-width-or-height
- (/ (if (eq split-window-function #'split-window-vertically)
- (window-height wind-A)
- (window-width wind-A))
- 3)))
-
- (funcall split-window-function wind-width-or-height)
+ (funcall split-window-function)
(if (eq (selected-window) wind-A)
(other-window 1))
@@ -443,7 +432,7 @@ keyboard input to go into icons."
(if three-way-comparison
(progn
- (funcall split-window-function) ; equally
+ (funcall split-window-function)
(if (eq (selected-window) wind-B)
(other-window 1))
(switch-to-buffer buf-C)
@@ -461,7 +450,9 @@ keyboard input to go into icons."
(set-window-start wind-A wind-A-start)
(set-window-start wind-B wind-B-start)))
- (ediff-select-lowest-window)
+ (select-window (display-buffer-in-direction
+ control-buffer
+ '((direction . bottom))))
(ediff-setup-control-buffer control-buffer)
))
@@ -746,6 +737,7 @@ keyboard input to go into icons."
(and (not (frame-live-p frame-A))
(or ctl-frame-exists-p
(eq frame-B (selected-frame))))))
+ (window-combination-resize t)
wind-A-start wind-B-start
designated-minibuffer-frame)
@@ -758,7 +750,7 @@ keyboard input to go into icons."
'B ediff-narrow-bounds))))
(if use-same-frame
- (let (wind-width-or-height) ; this affects 3way setups only
+ (progn
(if (and (eq frame-A frame-B) (frame-live-p frame-A))
(select-frame frame-A)
;; avoid dedicated and non-splittable windows
@@ -767,15 +759,7 @@ keyboard input to go into icons."
(switch-to-buffer buf-A)
(setq wind-A (selected-window))
- (if three-way-comparison
- (setq wind-width-or-height
- (/
- (if (eq split-window-function #'split-window-vertically)
- (window-height wind-A)
- (window-width wind-A))
- 3)))
-
- (funcall split-window-function wind-width-or-height)
+ (funcall split-window-function)
(if (eq (selected-window) wind-A)
(other-window 1))
(switch-to-buffer buf-B)
@@ -858,7 +842,7 @@ keyboard input to go into icons."
(defun ediff-skip-unsuitable-frames (&optional ok-unsplittable)
"Skip unsplittable frames and frames that have dedicated windows.
-create a new splittable frame if none is found."
+Create a new splittable frame if none is found."
(if (ediff-window-display-p)
(let ((wind-frame (window-frame))
seen-windows)
diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el
index 3536cbf7381..97c84ae5a18 100644
--- a/lisp/vc/ediff.el
+++ b/lisp/vc/ediff.el
@@ -6,7 +6,7 @@
;; Created: February 2, 1994
;; Keywords: comparing, merging, patching, vc, tools, unix
;; Version: 2.81.6
-(defconst ediff-version "2.81.6" "The current version of Ediff")
+(defconst ediff-version "2.81.6" "The current version of Ediff.")
;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
;; file on 20/3/2008, and the maintainer agreed that when a bug is
@@ -551,9 +551,11 @@ symbol describing the Ediff job type; it defaults to
;;;###autoload
(defun ediff-directories (dir1 dir2 regexp)
- "Run Ediff on a pair of directories, DIR1 and DIR2, comparing files that have
-the same name in both. The third argument, REGEXP, is nil or a regular
-expression; only file names that match the regexp are considered."
+ "Run Ediff on directories DIR1 and DIR2, comparing files.
+Consider only files that have the same name in both directories.
+
+REGEXP is nil or a regular expression; only file names that match
+the regexp are considered."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp t))
@@ -608,10 +610,11 @@ names. Only the files that are under revision control are taken into account."
;;;###autoload
(defun ediff-directories3 (dir1 dir2 dir3 regexp)
- "Run Ediff on three directories, DIR1, DIR2, and DIR3, comparing files that
-have the same name in all three. The last argument, REGEXP, is nil or a
-regular expression; only file names that match the regexp are considered."
+ "Run Ediff on directories DIR1, DIR2, and DIR3, comparing files.
+Consider only files that have the same name in all three directories.
+REGEXP is nil or a regular expression; only file names that match
+the regexp are considered."
(interactive
(let ((dir-A (ediff-get-default-directory-name))
(default-regexp (eval ediff-default-filtering-regexp t))
@@ -677,7 +680,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
(defun ediff-merge-directories-with-ancestor (dir1 dir2 ancestor-dir regexp
&optional
merge-autostore-dir)
- "Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors.
+ "Merge files in DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors.
Ediff merges files that have identical names in DIR1, DIR2. If a pair of files
in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge
without ancestor. The fourth argument, REGEXP, is nil or a regular expression;
@@ -743,7 +746,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
(defun ediff-merge-directory-revisions-with-ancestor (dir1 regexp
&optional
merge-autostore-dir)
- "Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors.
+ "Run Ediff on DIR1 and merge its files with their revisions and ancestors.
The second argument, REGEXP, is a regular expression that filters the file
names. Only the files that are under revision control are taken into account.
MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
@@ -980,9 +983,9 @@ STARTUP-HOOKS is a list of functions that Emacs calls without
arguments after setting up the Ediff buffers."
(interactive
(let (bf)
- (list (setq bf (read-buffer "Region's A buffer: "
+ (list (setq bf (read-buffer "Region A's buffer: "
(ediff-other-buffer "") t))
- (read-buffer "Region's B buffer: "
+ (read-buffer "Region B's buffer: "
(progn
;; realign buffers so that two visible bufs will be
;; at the top
@@ -1597,7 +1600,7 @@ With optional NODE, goes to that node."
;;;###autoload
(defun ediff-merge-with-ancestor-command ()
- "Call `ediff-merge-files-with-ancestor' with the next three command line arguments."
+ "Call `ediff-merge-files-with-ancestor' with next three command line arguments."
(let ((file-a (nth 0 command-line-args-left))
(file-b (nth 1 command-line-args-left))
(ancestor (nth 2 command-line-args-left)))
@@ -1634,7 +1637,8 @@ With optional NODE, goes to that node."
;;;###autoload
(defun ediff-merge-directories-with-ancestor-command ()
- "Call `ediff-merge-directories-with-ancestor' with the next four command line arguments."
+ "Call `ediff-merge-directories-with-ancestor' with the next four command line
+arguments."
(let ((file-a (nth 0 command-line-args-left))
(file-b (nth 1 command-line-args-left))
(ancestor (nth 2 command-line-args-left))
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el
index 8f7affeea4e..b2fdb07d5fb 100644
--- a/lisp/vc/emerge.el
+++ b/lisp/vc/emerge.el
@@ -26,15 +26,18 @@
;;; Macros
-(defmacro emerge-defvar-local (var value doc)
+(defmacro emerge-defvar-local (symbol value &optional doc)
"Define SYMBOL as an advertised buffer-local variable.
-Performs a defvar, then executes `make-variable-buffer-local' on
-the variable. Also sets the `permanent-local' property, so that
-`kill-all-local-variables' (called by major-mode setting commands)
-won't destroy Emerge control variables."
+Run `defvar-local', setting the value of the variable to VALUE
+and its docstring to DOC.
+
+Then set the `permanent-local' property, so that
+`kill-all-local-variables' (called by major-mode setting
+commands) won't destroy Emerge control variables."
+ (declare (indent defun) (doc-string 3))
`(progn
- (defvar-local ,var ,value ,doc)
- (put ',var 'permanent-local t)))
+ (defvar-local ,symbol ,value ,doc)
+ (put ',symbol 'permanent-local t)))
;; We need to define this function so describe-mode can describe Emerge mode.
(define-minor-mode emerge-mode
@@ -217,8 +220,7 @@ depend on the flags."
(emerge-new-flags)
(defcustom emerge-min-visible-lines 3
- "Number of lines that we want to show above and below the flags when we are
-displaying a difference."
+ "Number of lines to show above and below the flags when displaying a difference."
:type 'integer)
(defcustom emerge-temp-file-prefix
@@ -434,8 +436,7 @@ or nil if there is none.")
'((buffer-modified-p set-buffer-modified-p)
buffer-read-only
buffer-auto-save-file-name)
- "Variables and properties of a buffer which are saved, modified and restored
-during a merge.")
+ "Variables and properties of a buffer to save, modify and restore during a merge.")
(defconst emerge-merging-values '(nil t nil)
"Values to be assigned to emerge-saved-variables during a merge.")
@@ -481,10 +482,10 @@ replaced by emerge-fast-keymap.")
(emerge-defvar-local emerge-old-keymap nil
"The original local keymap for the merge buffer.")
(emerge-defvar-local emerge-auto-advance nil
- "If non-nil, emerge-select-A and emerge-select-B automatically advance to
+ "If non-nil, emerge-select-A and emerge-select-B automatically advance to
the next difference.")
(emerge-defvar-local emerge-skip-prefers nil
- "If non-nil, differences for which there is a preference are automatically
+ "If non-nil, differences for which there is a preference are automatically
skipped.")
(emerge-defvar-local emerge-quit-hook nil
"Hooks to run in the merge buffer after the merge has been finished.
@@ -825,7 +826,7 @@ This is *not* a user option, since Emerge uses it for its own processing.")
;;;###autoload
(defun emerge-files (_arg file-A file-B file-out &optional startup-hooks
quit-hooks)
- "Run Emerge on two files."
+ "Run Emerge on two files FILE-A and FILE-B."
(interactive
(let (f)
(list current-prefix-arg
@@ -874,7 +875,7 @@ This is *not* a user option, since Emerge uses it for its own processing.")
;;;###autoload
(defun emerge-buffers (buffer-A buffer-B &optional startup-hooks quit-hooks)
- "Run Emerge on two buffers."
+ "Run Emerge on two buffers BUFFER-A and BUFFER-B."
(interactive "bBuffer A to merge: \nbBuffer B to merge: ")
(let ((emerge-file-A (emerge-make-temp-file "A"))
(emerge-file-B (emerge-make-temp-file "B")))
@@ -1773,15 +1774,15 @@ BEG must be at the beginning of a line."
(emerge-unselect-and-select-difference n)))
(error "At beginning")))
-(defun emerge-jump-to-difference (difference-number)
- "Go to the N-th difference."
+(defun emerge-jump-to-difference (n)
+ "Go to difference number N."
(interactive "p")
(let ((inhibit-read-only t))
- (setq difference-number (1- difference-number))
- (if (and (>= difference-number -1)
- (< difference-number (1+ emerge-number-of-differences)))
- (emerge-unselect-and-select-difference difference-number)
- (error "Bad difference number"))))
+ (setq n (1- n))
+ (if (and (>= n -1)
+ (< n (1+ emerge-number-of-differences)))
+ (emerge-unselect-and-select-difference n)
+ (error "Bad difference number: %s" n))))
(defun emerge-abort ()
"Abort the Emerge session."
@@ -1790,7 +1791,7 @@ BEG must be at the beginning of a line."
(defun emerge-quit (arg)
"Finish the Emerge session and exit Emerge.
-Prefix argument means to abort rather than successfully finish.
+Prefix argument ARG means to abort rather than successfully finish.
The difference depends on how the merge was started,
but usually means to not write over one of the original files, or to signal
to some process which invoked Emerge a failure code.
@@ -1849,7 +1850,7 @@ buffer after this will cause serious problems."
"Select the A variant of this difference.
Refuses to function if this difference has been edited, i.e., if it
is neither the A nor the B variant.
-A prefix argument forces the variant to be selected
+With prefix argument FORCE, force the variant to be selected
even if the difference has been edited."
(interactive "P")
(let ((operate #'emerge-select-A-edit)
@@ -1876,7 +1877,7 @@ even if the difference has been edited."
"Select the B variant of this difference.
Refuses to function if this difference has been edited, i.e., if it
is neither the A nor the B variant.
-A prefix argument forces the variant to be selected
+With prefix argument FORCE, force the variant to be selected
even if the difference has been edited."
(interactive "P")
(let ((operate #'emerge-select-B-edit)
@@ -1973,8 +1974,8 @@ must be prefixed with \\<emerge-fast-keymap>\\[emerge-basic-keymap]."
"Toggle Auto-Advance mode, for Emerge.
This mode causes `emerge-select-A' and `emerge-select-B' to automatically
advance to the next difference.
-With a positive argument, turn on Auto-Advance mode.
-With a negative argument, turn off Auto-Advance mode."
+With a positive argument ARG, turn on Auto-Advance mode.
+With a negative argument ARG, turn off Auto-Advance mode."
(interactive "P")
(setq emerge-auto-advance (if (null arg)
(not emerge-auto-advance)
@@ -1988,8 +1989,8 @@ With a negative argument, turn off Auto-Advance mode."
"Toggle Skip-Prefers mode, for Emerge.
This mode causes `emerge-next-difference' and `emerge-previous-difference'
to automatically skip over differences for which there is a preference.
-With a positive argument, turn on Skip-Prefers mode.
-With a negative argument, turn off Skip-Prefers mode."
+With a positive argument ARG, turn on Skip-Prefers mode.
+With a negative argument ARG, turn off Skip-Prefers mode."
(interactive "P")
(setq emerge-skip-prefers (if (null arg)
(not emerge-skip-prefers)
@@ -2028,7 +2029,7 @@ With a negative argument, turn off Skip-Prefers mode."
(defun emerge-insert-A (arg)
"Insert the A variant of this difference at the point.
Leaves point after text, mark before.
-With prefix argument, puts point before, mark after."
+With prefix argument ARG, puts point before, mark after."
(interactive "P")
(emerge-validate-difference)
(let* ((diff-vector
@@ -2046,7 +2047,7 @@ With prefix argument, puts point before, mark after."
(defun emerge-insert-B (arg)
"Insert the B variant of this difference at the point.
Leaves point after text, mark before.
-With prefix argument, puts point before, mark after."
+With prefix argument ARG, puts point before, mark after."
(interactive "P")
(emerge-validate-difference)
(let* ((diff-vector
@@ -2062,8 +2063,8 @@ With prefix argument, puts point before, mark after."
(goto-char opoint))))
(defun emerge-mark-difference (arg)
- "Leaves the point before this difference and the mark after it.
-With prefix argument, puts mark before, point after."
+ "Leave the point before this difference and the mark after it.
+With prefix argument ARG, put mark before, point after."
(interactive "P")
(emerge-validate-difference)
(let* ((diff-vector
@@ -2079,7 +2080,7 @@ With prefix argument, puts mark before, point after."
(defun emerge-file-names ()
"Show the names of the buffers or files being operated on by Emerge.
-Use C-u l to reset the windows afterward."
+Use \\[universal-argument] l to reset the windows afterward."
(interactive)
(delete-other-windows)
(let ((temp-buffer-show-function
@@ -2122,7 +2123,7 @@ Use C-u l to reset the windows afterward."
(defun emerge-join-differences (arg)
"Join the selected difference with the following one.
-With a prefix argument, join with the preceding one."
+With a prefix argument ARG, join with the preceding one."
(interactive "P")
(let ((n emerge-current-difference))
;; adjust n to be first difference to join
@@ -2332,9 +2333,9 @@ ancestor version does not share.)"
;; to have it ask for a buffer.
(defun emerge-find-difference (arg)
"Find the difference containing the current position of the point.
-If there is no containing difference and the prefix argument is positive,
-it finds the nearest following difference. A negative prefix argument finds
-the nearest previous difference."
+If there is no containing difference and the prefix argument ARG
+is positive, find the nearest following difference. With
+negative prefix argument, find the nearest previous difference."
(interactive "P")
(cond ((eq (current-buffer) emerge-A-buffer)
(emerge-find-difference-A arg))
@@ -2344,9 +2345,9 @@ the nearest previous difference."
(defun emerge-find-difference-merge (arg)
"Find the difference containing point, in the merge buffer.
-If there is no containing difference and the prefix argument is positive,
-it finds the nearest following difference. A negative prefix argument finds
-the nearest previous difference."
+If there is no containing difference and the prefix argument ARG
+is positive, find the nearest following difference. With
+negative prefix argument, find the nearest previous difference."
(interactive "P")
;; search for the point in the merge buffer, using the markers
;; for the beginning and end of the differences in the merge buffer
@@ -2355,9 +2356,9 @@ the nearest previous difference."
(defun emerge-find-difference-A (arg)
"Find the difference containing point, in the A buffer.
This command must be executed in the merge buffer.
-If there is no containing difference and the prefix argument is positive,
-it finds the nearest following difference. A negative prefix argument finds
-the nearest previous difference."
+If there is no containing difference and the prefix argument ARG
+is positive, find the nearest following difference. With
+negative prefix argument, find the nearest previous difference."
(interactive "P")
;; search for the point in the A buffer, using the markers
;; for the beginning and end of the differences in the A buffer
@@ -2368,9 +2369,9 @@ the nearest previous difference."
(defun emerge-find-difference-B (arg)
"Find the difference containing point, in the B buffer.
This command must be executed in the merge buffer.
-If there is no containing difference and the prefix argument is positive,
-it finds the nearest following difference. A negative prefix argument finds
-the nearest previous difference."
+If there is no containing difference and the prefix argument ARG
+is positive, find the nearest following difference. With
+negative prefix argument, find the nearest previous difference."
(interactive "P")
;; search for the point in the B buffer, using the markers
;; for the beginning and end of the differences in the B buffer
@@ -2450,8 +2451,10 @@ merge buffers."
(defun emerge-set-combine-template (string &optional localize)
"Set `emerge-combine-versions-template' to STRING.
This value controls how `emerge-combine-versions' combines the two versions.
-With prefix argument, `emerge-combine-versions-template' is made local to this
-merge buffer. Localization is permanent for any particular merge buffer."
+
+With prefix argument LOCALIZE, `emerge-combine-versions-template'
+is made local to this merge buffer. Localization is permanent
+for any particular merge buffer."
(interactive "s\nP")
(if localize
(make-local-variable 'emerge-combine-versions-template))
@@ -2464,8 +2467,10 @@ merge buffer. Localization is permanent for any particular merge buffer."
(defun emerge-set-combine-versions-template (start end &optional localize)
"Copy region into `emerge-combine-versions-template'.
This controls how `emerge-combine-versions' will combine the two versions.
-With prefix argument, `emerge-combine-versions-template' is made local to this
-merge buffer. Localization is permanent for any particular merge buffer."
+
+With prefix argument LOCALIZE, `emerge-combine-versions-template'
+is made local to this merge buffer. Localization is permanent
+for any particular merge buffer."
(interactive "r\nP")
(if localize
(make-local-variable 'emerge-combine-versions-template))
@@ -2479,8 +2484,9 @@ merge buffer. Localization is permanent for any particular merge buffer."
"Combine versions using the template in `emerge-combine-versions-template'.
Refuses to function if this difference has been edited, i.e., if it is
neither the A nor the B variant.
-An argument forces the variant to be selected even if the difference has
-been edited."
+
+With prefix argument FORCE, force the variant to be selected even
+if the difference has been edited."
(interactive "P")
(emerge-combine-versions-internal emerge-combine-versions-template force))
@@ -2490,8 +2496,9 @@ See documentation of the variable `emerge-combine-versions-template'
for how the template is interpreted.
Refuses to function if this difference has been edited, i.e., if it is
neither the A nor the B variant.
-An argument forces the variant to be selected even if the difference has
-been edited.
+
+With prefix argument CHAR, force the variant to be selected even
+if the difference has been edited.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list
@@ -2539,9 +2546,9 @@ Interactively, reads the register using `register-read-with-preview'."
(if emerge-auto-advance (emerge-next-difference))))
(defun emerge-set-merge-mode (mode)
- "Set the major mode in a merge buffer.
-Overrides any change that the mode might make to the mode line or local
-keymap. Leaves merge in fast mode."
+ "Set the major mode to MODE in a merge buffer.
+Override any change that the mode might make to the mode line or
+local keymap. Leave merge in fast mode."
(interactive
(list (intern (completing-read "New major mode for merge buffer: "
obarray 'commandp t nil))))
@@ -2678,8 +2685,8 @@ keymap. Leaves merge in fast mode."
(emerge-refresh-mode-line))))
(defun emerge-select-version (force a-version b-version neither-version)
- "Perform tests to see whether user should be allowed to select a version
-of this difference:
+ "Test if user should be allowed to select a version of this difference.
+This is the case if:
a valid difference has been selected; and
the difference text in the merge buffer is:
the A version (execute a-version), or
@@ -2847,7 +2854,9 @@ Otherwise, signal an error."
;; When the pointless option emerge-temp-file-prefix goes,
;; make this function obsolete too, and just use make-temp-file.
(defun emerge-make-temp-file (prefix)
- "Make a private temporary file based on `emerge-temp-file-prefix'."
+ "Make a private temporary file based on PREFIX.
+This is named by concatenating `emerge-temp-file-prefix' with
+PREFIX."
(make-temp-file (concat emerge-temp-file-prefix prefix)))
;;; Functions that query the user before he can write out the current buffer.
@@ -2921,7 +2930,7 @@ around the current difference are removed."
;; Define a key, even if a prefix of it is defined
(defun emerge-force-define-key (keymap key definition)
- "Like `define-key', but forcibly creates prefix characters as needed.
+ "Like `define-key', but forcibly create prefix characters as needed.
If some prefix of KEY has a non-prefix definition, it is redefined."
;; Find out if a prefix of key is defined
(let ((v (lookup-key keymap key)))
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 4a44787bb03..c8d089e4113 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -54,21 +54,19 @@
(define-obsolete-variable-alias 'vc-log-mode-map 'log-edit-mode-map "28.1")
(define-obsolete-variable-alias 'vc-log-entry-mode 'log-edit-mode-map "28.1")
-(easy-mmode-defmap log-edit-mode-map
- '(("\C-c\C-c" . log-edit-done)
- ("\C-c\C-a" . log-edit-insert-changelog)
- ("\C-c\C-w" . log-edit-generate-changelog-from-diff)
- ("\C-c\C-d" . log-edit-show-diff)
- ("\C-c\C-f" . log-edit-show-files)
- ("\C-c\C-k" . log-edit-kill-buffer)
- ("\C-a" . log-edit-beginning-of-line)
- ("\M-n" . log-edit-next-comment)
- ("\M-p" . log-edit-previous-comment)
- ("\M-r" . log-edit-comment-search-backward)
- ("\M-s" . log-edit-comment-search-forward)
- ("\C-c?" . log-edit-mode-help))
- "Keymap for the `log-edit-mode' (to edit version control log messages)."
- :group 'log-edit)
+(defvar-keymap log-edit-mode-map
+ (kbd "C-c C-c") #'log-edit-done
+ (kbd "C-c C-a") #'log-edit-insert-changelog
+ (kbd "C-c C-w") #'log-edit-generate-changelog-from-diff
+ (kbd "C-c C-d") #'log-edit-show-diff
+ (kbd "C-c C-f") #'log-edit-show-files
+ (kbd "C-c C-k") #'log-edit-kill-buffer
+ (kbd "C-a") #'log-edit-beginning-of-line
+ (kbd "M-n") #'log-edit-next-comment
+ (kbd "M-p") #'log-edit-previous-comment
+ (kbd "M-r") #'log-edit-comment-search-backward
+ (kbd "M-s") #'log-edit-comment-search-forward
+ (kbd "C-c ?") #'log-edit-mode-help)
(easy-menu-define log-edit-menu log-edit-mode-map
"Menu used for `log-edit-mode'."
@@ -98,7 +96,7 @@
(defcustom log-edit-confirm 'changed
"If non-nil, `log-edit-done' will request confirmation.
If `changed', only request confirmation if the list of files has
- changed since the beginning of the log-edit session."
+ changed since the beginning of the `log-edit' session."
:group 'log-edit
:type '(choice (const changed) (const t) (const nil)))
@@ -497,7 +495,7 @@ When done editing the log entry, type \\[log-edit-done], which will
trigger the actual commit of the file(s).
Several other handy support commands are provided, and the package
from which this is used might also provide additional commands (under
-the \"C-x v\" prefix for VC commands, for example).
+the \\[vc-prefix-map] prefix for VC commands, for example).
\\{log-edit-mode-map}"
(setq-local font-lock-defaults '(log-edit-font-lock-keywords t))
@@ -891,7 +889,7 @@ name or time."
Actually, the narrowed region doesn't include the date line.
A \"page\" in a ChangeLog file is the area between two dates."
(or (eq major-mode 'change-log-mode)
- (error "log-edit-narrow-changelog: current buffer isn't a ChangeLog"))
+ (error "log-edit-narrow-changelog: Current buffer isn't a ChangeLog"))
(goto-char (point-min))
@@ -974,8 +972,8 @@ Return non-nil if it is."
(not (looking-at (format ".+ .+ <%s>"
(regexp-quote mail))))
(looking-at ".+ \\(.+ <.+>\\) *\\((tiny change)\\)?"))
- (let ((author (replace-regexp-in-string " " " "
- (match-string 1))))
+ (let ((author (string-replace " " " "
+ (match-string 1))))
(unless (and log-edit-author
(string-match (regexp-quote author)
(car log-edit-author)))
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index e8930979b5d..2c78000e38b 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -50,7 +50,7 @@
;; ------------------------------------------------------------------------
;; r4622 | ckuethe | 2007-12-23 18:18:01 -0500 (Sun, 23 Dec 2007) | 2 lines
;;
-;; uBlox AEK-4T in binary mode. Added to unstable because it breaks gpsfake
+;; uBlox AEK-4T in binary mode. Added to unstable because it breaks gpsfake
;;
;; ------------------------------------------------------------------------
;; r4621 | ckuethe | 2007-12-23 16:48:11 -0500 (Sun, 23 Dec 2007) | 3 lines
@@ -110,6 +110,7 @@
;;; Code:
(require 'pcvs-util)
+(require 'easy-mmode)
(autoload 'vc-find-revision "vc")
(autoload 'vc-diff-internal "vc")
@@ -121,42 +122,26 @@
:group 'pcl-cvs
:prefix "log-view-")
-(easy-mmode-defmap log-view-mode-map
- '(
- ("-" . negative-argument)
- ("0" . digit-argument)
- ("1" . digit-argument)
- ("2" . digit-argument)
- ("3" . digit-argument)
- ("4" . digit-argument)
- ("5" . digit-argument)
- ("6" . digit-argument)
- ("7" . digit-argument)
- ("8" . digit-argument)
- ("9" . digit-argument)
-
- ("\C-m" . log-view-toggle-entry-display)
- ("m" . log-view-toggle-mark-entry)
- ("e" . log-view-modify-change-comment)
- ("d" . log-view-diff)
- ("=" . log-view-diff)
- ("D" . log-view-diff-changeset)
- ("a" . log-view-annotate-version)
- ("f" . log-view-find-revision)
- ("n" . log-view-msg-next)
- ("p" . log-view-msg-prev)
- ("\t" . log-view-msg-next)
- ([backtab] . log-view-msg-prev)
- ("N" . log-view-file-next)
- ("P" . log-view-file-prev)
- ("\M-n" . log-view-file-next)
- ("\M-p" . log-view-file-prev))
- "Log-View's keymap."
- :inherit special-mode-map
- :group 'log-view)
+(defvar-keymap log-view-mode-map
+ (kbd "RET") #'log-view-toggle-entry-display
+ "m" #'log-view-toggle-mark-entry
+ "e" #'log-view-modify-change-comment
+ "d" #'log-view-diff
+ "=" #'log-view-diff
+ "D" #'log-view-diff-changeset
+ "a" #'log-view-annotate-version
+ "f" #'log-view-find-revision
+ "n" #'log-view-msg-next
+ "p" #'log-view-msg-prev
+ (kbd "TAB") #'log-view-msg-next
+ (kbd "<backtab>") #'log-view-msg-prev
+ "N" #'log-view-file-next
+ "P" #'log-view-file-prev
+ (kbd "M-n") #'log-view-file-next
+ (kbd "M-p") #'log-view-file-prev)
(easy-menu-define log-view-mode-menu log-view-mode-map
- "Log-View Display Menu"
+ "Log-View Display Menu."
'("Log-View"
;; XXX Do we need menu entries for these?
;; ["Quit" quit-window]
diff --git a/lisp/vc/pcvs-defs.el b/lisp/vc/pcvs-defs.el
index 54ef06960f9..c3109f7e85b 100644
--- a/lisp/vc/pcvs-defs.el
+++ b/lisp/vc/pcvs-defs.el
@@ -264,160 +264,6 @@ This variable is buffer local and only used in the *cvs* buffer.")
(defconst cvs-vendor-branch "1.1.1"
"The default branch used by CVS for vendor code.")
-(easy-mmode-defmap cvs-mode-diff-map
- '(("E" "imerge" . cvs-mode-imerge)
- ("=" . cvs-mode-diff)
- ("e" "idiff" . cvs-mode-idiff)
- ("2" "other" . cvs-mode-idiff-other)
- ("d" "diff" . cvs-mode-diff)
- ("b" "backup" . cvs-mode-diff-backup)
- ("h" "head" . cvs-mode-diff-head)
- ("r" "repository" . cvs-mode-diff-repository)
- ("y" "yesterday" . cvs-mode-diff-yesterday)
- ("v" "vendor" . cvs-mode-diff-vendor))
- "Keymap for diff-related operations in `cvs-mode'."
- :name "Diff")
-;; This is necessary to allow correct handling of \\[cvs-mode-diff-map]
-;; in substitute-command-keys.
-(fset 'cvs-mode-diff-map cvs-mode-diff-map)
-
-(easy-mmode-defmap cvs-mode-map
- ;;(define-prefix-command 'cvs-mode-map-diff-prefix)
- ;;(define-prefix-command 'cvs-mode-map-control-c-prefix)
- '(;; various
- ;; (undo . cvs-mode-undo)
- ("?" . cvs-help)
- ("h" . cvs-help)
- ("q" . cvs-bury-buffer)
- ("z" . kill-this-buffer)
- ("F" . cvs-mode-set-flags)
- ;; ("\M-f" . cvs-mode-force-command)
- ("!" . cvs-mode-force-command)
- ("\C-c\C-c" . cvs-mode-kill-process)
- ;; marking
- ("m" . cvs-mode-mark)
- ("M" . cvs-mode-mark-all-files)
- ("S" . cvs-mode-mark-on-state)
- ("u" . cvs-mode-unmark)
- ("\C-?". cvs-mode-unmark-up)
- ("%" . cvs-mode-mark-matching-files)
- ("T" . cvs-mode-toggle-marks)
- ("\M-\C-?" . cvs-mode-unmark-all-files)
- ;; navigation keys
- (" " . cvs-mode-next-line)
- ("n" . cvs-mode-next-line)
- ("p" . cvs-mode-previous-line)
- ("\t" . cvs-mode-next-line)
- ([backtab] . cvs-mode-previous-line)
- ;; M- keys are usually those that operate on modules
- ;;("\M-C". cvs-mode-rcs2log) ; i.e. "Create a ChangeLog"
- ;;("\M-t". cvs-rtag)
- ;;("\M-l". cvs-rlog)
- ("\M-c". cvs-checkout)
- ("\M-e". cvs-examine)
- ("g" . cvs-mode-revert-buffer)
- ("\M-u". cvs-update)
- ("\M-s". cvs-status)
- ;; diff commands
- ("=" . cvs-mode-diff)
- ("d" . cvs-mode-diff-map)
- ;; keys that operate on individual files
- ("\C-k" . cvs-mode-acknowledge)
- ("A" . cvs-mode-add-change-log-entry-other-window)
- ;;("B" . cvs-mode-byte-compile-files)
- ("C" . cvs-mode-commit-setup)
- ("O" . cvs-mode-update)
- ("U" . cvs-mode-undo)
- ("I" . cvs-mode-insert)
- ("a" . cvs-mode-add)
- ("b" . cvs-set-branch-prefix)
- ("B" . cvs-set-secondary-branch-prefix)
- ("c" . cvs-mode-commit)
- ("e" . cvs-mode-examine)
- ("f" . cvs-mode-find-file)
- ("\C-m" . cvs-mode-find-file)
- ("i" . cvs-mode-ignore)
- ("l" . cvs-mode-log)
- ("o" . cvs-mode-find-file-other-window)
- ("r" . cvs-mode-remove)
- ("s" . cvs-mode-status)
- ("t" . cvs-mode-tag)
- ("v" . cvs-mode-view-file)
- ("x" . cvs-mode-remove-handled)
- ;; cvstree bindings
- ("+" . cvs-mode-tree)
- ;; mouse bindings
- ([mouse-2] . cvs-mode-find-file)
- ([follow-link] . (lambda (pos)
- (if (eq (get-char-property pos 'face) 'cvs-filename) t)))
- ([(down-mouse-3)] . cvs-menu)
- ;; dired-like bindings
- ("\C-o" . cvs-mode-display-file)
- ;; Emacs-21 toolbar
- ;;([tool-bar item1] . (menu-item "Examine" cvs-examine :image (image :file "/usr/share/icons/xpaint.xpm" :type xpm)))
- ;;([tool-bar item2] . (menu-item "Update" cvs-update :image (image :file "/usr/share/icons/mail1.xpm" :type xpm)))
- )
- "Keymap for `cvs-mode'."
- :dense t
- :suppress t)
-
-(fset 'cvs-mode-map cvs-mode-map)
-
-(easy-menu-define cvs-menu cvs-mode-map "Menu used in `cvs-mode'."
- '("CVS"
- ["Open file" cvs-mode-find-file t]
- ["Open in other window" cvs-mode-find-file-other-window t]
- ["Display in other window" cvs-mode-display-file t]
- ["Interactive merge" cvs-mode-imerge t]
- ("View diff"
- ["Interactive diff" cvs-mode-idiff t]
- ["Current diff" cvs-mode-diff t]
- ["Diff with head" cvs-mode-diff-head t]
- ["Diff with vendor" cvs-mode-diff-vendor t]
- ["Diff against yesterday" cvs-mode-diff-yesterday t]
- ["Diff with backup" cvs-mode-diff-backup t])
- ["View log" cvs-mode-log t]
- ["View status" cvs-mode-status t]
- ["View tag tree" cvs-mode-tree t]
- "----"
- ["Insert" cvs-mode-insert]
- ["Update" cvs-mode-update (cvs-enabledp 'update)]
- ["Re-examine" cvs-mode-examine t]
- ["Commit" cvs-mode-commit-setup (cvs-enabledp 'commit)]
- ["Tag" cvs-mode-tag (cvs-enabledp (when cvs-force-dir-tag 'tag))]
- ["Undo changes" cvs-mode-undo (cvs-enabledp 'undo)]
- ["Add" cvs-mode-add (cvs-enabledp 'add)]
- ["Remove" cvs-mode-remove (cvs-enabledp 'remove)]
- ["Ignore" cvs-mode-ignore (cvs-enabledp 'ignore)]
- ["Add ChangeLog" cvs-mode-add-change-log-entry-other-window t]
- "----"
- ["Mark" cvs-mode-mark t]
- ["Mark all" cvs-mode-mark-all-files t]
- ["Mark by regexp..." cvs-mode-mark-matching-files t]
- ["Mark by state..." cvs-mode-mark-on-state t]
- ["Unmark" cvs-mode-unmark t]
- ["Unmark all" cvs-mode-unmark-all-files t]
- ["Hide handled" cvs-mode-remove-handled t]
- "----"
- ["PCL-CVS Manual" (lambda () (interactive)
- (info "(pcl-cvs)Top")) t]
- "----"
- ["Quit" cvs-mode-quit t]))
-
-;;;;
-;;;; CVS-Minor mode
-;;;;
-
-(defcustom cvs-minor-mode-prefix "\C-xc"
- "Prefix key for the `cvs-mode' bindings in `cvs-minor-mode'."
- :type 'string)
-
-(easy-mmode-defmap cvs-minor-mode-map
- `((,cvs-minor-mode-prefix . cvs-mode-map)
- ("e" . (menu-item nil cvs-mode-edit-log
- :filter (lambda (x) (if (derived-mode-p 'log-view-mode) x)))))
- "Keymap for `cvs-minor-mode', used in buffers related to PCL-CVS.")
-
(defvar cvs-buffer nil
"(Buffer local) The *cvs* buffer associated with this buffer.")
(put 'cvs-buffer 'permanent-local t)
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 42f531e4f75..2daa42fbf8f 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -117,11 +117,11 @@
(require 'cl-lib)
(require 'ewoc) ;Ewoc was once cookie
-(require 'pcvs-defs)
(require 'pcvs-util)
(require 'pcvs-parse)
(require 'pcvs-info)
(require 'vc-cvs)
+(require 'easy-mmode)
;;;;
@@ -138,6 +138,147 @@
(defvar cvs-from-vc nil "Bound to t inside VC advice.")
+(defvar-keymap cvs-mode-diff-map
+ :name "Diff"
+ "E" (cons "imerge" #'cvs-mode-imerge)
+ "=" #'cvs-mode-diff
+ "e" (cons "idiff" #'cvs-mode-idiff)
+ "2" (cons "other" #'cvs-mode-idiff-other)
+ "d" (cons "diff" #'cvs-mode-diff)
+ "b" (cons "backup" #'cvs-mode-diff-backup)
+ "h" (cons "head" #'cvs-mode-diff-head)
+ "r" (cons "repository" #'cvs-mode-diff-repository)
+ "y" (cons "yesterday" #'cvs-mode-diff-yesterday)
+ "v" (cons "vendor" #'cvs-mode-diff-vendor))
+;; This is necessary to allow correct handling of \\[cvs-mode-diff-map]
+;; in substitute-command-keys.
+(fset 'cvs-mode-diff-map cvs-mode-diff-map)
+
+(defvar-keymap cvs-mode-map
+ :full t
+ :suppress t
+ ;; various
+ "?" #'cvs-help
+ "h" #'cvs-help
+ "q" #'cvs-bury-buffer
+ "z" #'kill-this-buffer
+ "F" #'cvs-mode-set-flags
+ "!" #'cvs-mode-force-command
+ ["C-c C-c"] #'cvs-mode-kill-process
+ ;; marking
+ "m" #'cvs-mode-mark
+ "M" #'cvs-mode-mark-all-files
+ "S" #'cvs-mode-mark-on-state
+ "u" #'cvs-mode-unmark
+ ["DEL"] #'cvs-mode-unmark-up
+ "%" #'cvs-mode-mark-matching-files
+ "T" #'cvs-mode-toggle-marks
+ ["M-DEL"] #'cvs-mode-unmark-all-files
+ ;; navigation keys
+ " " #'cvs-mode-next-line
+ "n" #'cvs-mode-next-line
+ "p" #'cvs-mode-previous-line
+ "\t" #'cvs-mode-next-line
+ [backtab] #'cvs-mode-previous-line
+ ;; M- keys are usually those that operate on modules
+ ["M-c"] #'cvs-checkout
+ ["M-e"] #'cvs-examine
+ "g" #'cvs-mode-revert-buffer
+ ["M-u"] #'cvs-update
+ ["M-s"] #'cvs-status
+ ;; diff commands
+ "=" #'cvs-mode-diff
+ "d" cvs-mode-diff-map
+ ;; keys that operate on individual files
+ ["C-k"] #'cvs-mode-acknowledge
+ "A" #'cvs-mode-add-change-log-entry-other-window
+ "C" #'cvs-mode-commit-setup
+ "O" #'cvs-mode-update
+ "U" #'cvs-mode-undo
+ "I" #'cvs-mode-insert
+ "a" #'cvs-mode-add
+ "b" #'cvs-set-branch-prefix
+ "B" #'cvs-set-secondary-branch-prefix
+ "c" #'cvs-mode-commit
+ "e" #'cvs-mode-examine
+ "f" #'cvs-mode-find-file
+ ["RET"] #'cvs-mode-find-file
+ "i" #'cvs-mode-ignore
+ "l" #'cvs-mode-log
+ "o" #'cvs-mode-find-file-other-window
+ "r" #'cvs-mode-remove
+ "s" #'cvs-mode-status
+ "t" #'cvs-mode-tag
+ "v" #'cvs-mode-view-file
+ "x" #'cvs-mode-remove-handled
+ ;; cvstree bindings
+ "+" #'cvs-mode-tree
+ ;; mouse bindings
+ [mouse-2] #'cvs-mode-find-file
+ [follow-link] (lambda (pos)
+ (eq (get-char-property pos 'face) 'cvs-filename))
+ [(down-mouse-3)] #'cvs-menu
+ ;; dired-like bindings
+ "\C-o" #'cvs-mode-display-file)
+
+(easy-menu-define cvs-menu cvs-mode-map "Menu used in `cvs-mode'."
+ '("CVS"
+ ["Open file" cvs-mode-find-file t]
+ ["Open in other window" cvs-mode-find-file-other-window t]
+ ["Display in other window" cvs-mode-display-file t]
+ ["Interactive merge" cvs-mode-imerge t]
+ ("View diff"
+ ["Interactive diff" cvs-mode-idiff t]
+ ["Current diff" cvs-mode-diff t]
+ ["Diff with head" cvs-mode-diff-head t]
+ ["Diff with vendor" cvs-mode-diff-vendor t]
+ ["Diff against yesterday" cvs-mode-diff-yesterday t]
+ ["Diff with backup" cvs-mode-diff-backup t])
+ ["View log" cvs-mode-log t]
+ ["View status" cvs-mode-status t]
+ ["View tag tree" cvs-mode-tree t]
+ "----"
+ ["Insert" cvs-mode-insert]
+ ["Update" cvs-mode-update (cvs-enabledp 'update)]
+ ["Re-examine" cvs-mode-examine t]
+ ["Commit" cvs-mode-commit-setup (cvs-enabledp 'commit)]
+ ["Tag" cvs-mode-tag (cvs-enabledp (when cvs-force-dir-tag 'tag))]
+ ["Undo changes" cvs-mode-undo (cvs-enabledp 'undo)]
+ ["Add" cvs-mode-add (cvs-enabledp 'add)]
+ ["Remove" cvs-mode-remove (cvs-enabledp 'remove)]
+ ["Ignore" cvs-mode-ignore (cvs-enabledp 'ignore)]
+ ["Add ChangeLog" cvs-mode-add-change-log-entry-other-window t]
+ "----"
+ ["Mark" cvs-mode-mark t]
+ ["Mark all" cvs-mode-mark-all-files t]
+ ["Mark by regexp..." cvs-mode-mark-matching-files t]
+ ["Mark by state..." cvs-mode-mark-on-state t]
+ ["Unmark" cvs-mode-unmark t]
+ ["Unmark all" cvs-mode-unmark-all-files t]
+ ["Hide handled" cvs-mode-remove-handled t]
+ "----"
+ ["PCL-CVS Manual" (lambda () (interactive)
+ (info "(pcl-cvs)Top")) t]
+ "----"
+ ["Quit" cvs-mode-quit t]))
+
+;;;;
+;;;; CVS-Minor mode
+;;;;
+
+(defcustom cvs-minor-mode-prefix "\C-xc"
+ "Prefix key for the `cvs-mode' bindings in `cvs-minor-mode'."
+ :type 'string
+ :group 'pcl-cvs)
+
+(defvar-keymap cvs-minor-mode-map
+ cvs-minor-mode-prefix 'cvs-mode-map
+ "e" '(menu-item nil cvs-mode-edit-log
+ :filter (lambda (x)
+ (and (derived-mode-p 'log-view-mode) x))))
+
+(require 'pcvs-defs)
+
;;;;
;;;; flags variables
;;;;
@@ -247,7 +388,7 @@ If -CVS-MODE!-FUN is provided, it is executed *cvs* being the current buffer
(let* ((-cvs-mode!-buf (current-buffer))
(cvsbuf (cond ((cvs-buffer-p) (current-buffer))
((and cvs-buffer (cvs-buffer-p cvs-buffer)) cvs-buffer)
- (t (error "can't find the *cvs* buffer"))))
+ (t (error "Can't find the *cvs* buffer"))))
(-cvs-mode!-wrapper cvs-minor-wrap-function)
(-cvs-mode!-cont (lambda ()
(save-current-buffer
@@ -672,7 +813,7 @@ it is finished."
(when cvs-postproc
(if (null procbuf)
;;(set-process-buffer proc nil)
- (error "cvs' process buffer was killed")
+ (error "CVS process buffer was killed")
(with-current-buffer procbuf
;; Do the postprocessing like parsing and such.
(save-excursion
@@ -758,6 +899,7 @@ clear what alternative to use.
- `DOUBLE' is the generic case."
(declare (debug (&define sexp lambda-list stringp
("interactive" interactive) def-body))
+ (indent defun)
(doc-string 3))
(let ((style (cvs-cdr fun))
(fun (cvs-car fun)))
@@ -1144,7 +1286,8 @@ Full documentation is in the Texinfo file."
("->" cvs-secondary-branch-prefix))))
" " cvs-mode-line-process))
(if buffer-file-name
- (error "Use M-x cvs-quickdir to get a *cvs* buffer"))
+ (error (substitute-command-keys
+ "Use \\[cvs-quickdir] to get a *cvs* buffer")))
(buffer-disable-undo)
;;(setq-local goal-column cvs-cursor-column)
(setq-local revert-buffer-function 'cvs-mode-revert-buffer)
@@ -1283,8 +1426,7 @@ marked instead. A directory can never be marked."
(intern
(upcase
(completing-read
- (concat
- "Mark files in state" (if default (concat " [" default "]")) ": ")
+ (format-prompt "Mark files in state" default)
(mapcar (lambda (x)
(list (downcase (symbol-name (car x)))))
cvs-states)
@@ -1503,7 +1645,7 @@ The POSTPROC specified there (typically `log-edit') is then called,
(defvar cvs-edit-log-revision)
(defvar cvs-edit-log-files) (put 'cvs-edit-log-files 'permanent-local t)
(defun cvs-mode-edit-log (file rev &optional text)
- "Edit the log message at point.
+ "Edit log message at point.
This is best called from a `log-view-mode' buffer."
(interactive
(list
@@ -1661,7 +1803,7 @@ See `cvs-mode-diff' for more info."
This command can be used on files that are marked with \"Merged\"
or \"Conflict\" in the *cvs* buffer."
(interactive (list (cvs-flags-query 'cvs-diff-flags "diff flags")))
- (unless (listp flags) (error "flags should be a list of strings"))
+ (unless (listp flags) (error "Flags should be a list of strings"))
(save-some-buffers)
(let* ((marked (cvs-get-marked (cvs-ignore-marks-p "diff")))
(fis (car (cvs-partition 'cvs-fileinfo->backup-file marked))))
@@ -1862,7 +2004,7 @@ POSTPROC is a function of no argument to be evaluated at the very end (after
(let ((def-dir default-directory))
;; Save the relevant buffers
(save-some-buffers nil (lambda () (cvs-is-within-p fis def-dir))))
- (unless (listp flags) (error "flags should be a list of strings"))
+ (unless (listp flags) (error "Flags should be a list of strings"))
;; Some w32 versions of CVS don't like an explicit . too much.
(when (and (car fis) (null (cdr fis))
(eq (cvs-fileinfo->type (car fis)) 'DIRCHANGE)
@@ -2259,7 +2401,7 @@ With prefix argument, prompt for cvs flags."
;;;;
(defun cvs-dir-member-p (fileinfo dir)
- "Return true if FILEINFO represents a file in directory DIR."
+ "Return non-nil if FILEINFO represents a file in directory DIR."
(and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
(string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
@@ -2316,7 +2458,7 @@ this file, or a list of arguments to send to the program."
(defun cvs-change-cvsroot (newroot)
- "Change the CVSROOT."
+ "Change the CVSROOT to NEWROOT."
(interactive "DNew repository: ")
(if (or (file-directory-p (expand-file-name "CVSROOT" newroot))
(y-or-n-p (concat "Warning: no CVSROOT found inside repository."
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 694d4529b97..2cc5ee739fd 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -47,6 +47,7 @@
(require 'diff) ;For diff-check-labels.
(require 'diff-mode) ;For diff-refine.
(require 'newcomment)
+(require 'easy-mmode)
;;; The real definition comes later.
(defvar smerge-mode)
@@ -142,25 +143,24 @@ Used in `smerge-diff-base-upper' and related functions."
"Face used for added characters shown by `smerge-refine'."
:version "24.3")
-(easy-mmode-defmap smerge-basic-map
- `(("n" . smerge-next)
- ("p" . smerge-prev)
- ("r" . smerge-resolve)
- ("a" . smerge-keep-all)
- ("b" . smerge-keep-base)
- ("o" . smerge-keep-lower) ; for the obsolete keep-other
- ("l" . smerge-keep-lower)
- ("m" . smerge-keep-upper) ; for the obsolete keep-mine
- ("u" . smerge-keep-upper)
- ("E" . smerge-ediff)
- ("C" . smerge-combine-with-next)
- ("R" . smerge-refine)
- ("\C-m" . smerge-keep-current)
- ("=" . ,(make-sparse-keymap "Diff"))
- ("=<" "base-upper" . smerge-diff-base-upper)
- ("=>" "base-lower" . smerge-diff-base-lower)
- ("==" "upper-lower" . smerge-diff-upper-lower))
- "The base keymap for `smerge-mode'.")
+(defvar-keymap smerge-basic-map
+ "n" #'smerge-next
+ "p" #'smerge-prev
+ "r" #'smerge-resolve
+ "a" #'smerge-keep-all
+ "b" #'smerge-keep-base
+ "o" #'smerge-keep-lower ; for the obsolete keep-other
+ "l" #'smerge-keep-lower
+ "m" #'smerge-keep-upper ; for the obsolete keep-mine
+ "u" #'smerge-keep-upper
+ "E" #'smerge-ediff
+ "C" #'smerge-combine-with-next
+ "R" #'smerge-refine
+ ["C-m"] #'smerge-keep-current
+ "=" (define-keymap :name "Diff"
+ "<" (cons "base-upper" #'smerge-diff-base-upper)
+ ">" (cons "base-lower" #'smerge-diff-base-lower)
+ "=" (cons "upper-lower" #'smerge-diff-upper-lower)))
(defcustom smerge-command-prefix "\C-c^"
"Prefix for `smerge-mode' commands."
@@ -169,9 +169,8 @@ Used in `smerge-diff-base-upper' and related functions."
(const :tag "none" "")
string))
-(easy-mmode-defmap smerge-mode-map
- `((,smerge-command-prefix . ,smerge-basic-map))
- "Keymap for `smerge-mode'.")
+(defvar-keymap smerge-mode-map
+ smerge-command-prefix smerge-basic-map)
(defvar-local smerge-check-cache nil)
(defun smerge-check (n)
@@ -214,6 +213,9 @@ Used in `smerge-diff-base-upper' and related functions."
["Invoke Ediff" smerge-ediff
:help "Use Ediff to resolve the conflicts"
:active (smerge-check 1)]
+ ["Refine" smerge-refine
+ :help "Highlight different words of the conflict"
+ :active (smerge-check 1)]
["Auto Resolve" smerge-resolve
:help "Try auto-resolution heuristics"
:active (smerge-check 1)]
@@ -958,7 +960,7 @@ It has the following disadvantages:
(defvar smerge--refine-long-words)
(defun smerge--refine-chopup-region (beg end file &optional preproc)
- "Chopup the region into small elements, one per line.
+ "Chopup the region from BEG to END into small elements, one per line.
Save the result into FILE.
If non-nil, PREPROC is called with no argument in a buffer that contains
a copy of the text, just before chopping it up. It can be used to replace
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index 07b2800c2dc..def87db8712 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -277,7 +277,7 @@ cover the range from the oldest annotation to the newest."
;; Menu -- Using easymenu.el
(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
- "VC Annotate Display Menu"
+ "VC Annotate Display Menu."
`("VC-Annotate"
["By Color Map Range" (unless (null vc-annotate-display-mode)
(setq vc-annotate-display-mode nil)
@@ -545,6 +545,7 @@ Return a cons (REV . FILENAME)."
(defvar log-view-vc-backend)
(defvar log-view-vc-fileset)
+(defvar vc-git-print-log-follow)
(defun vc-annotate-show-log-revision-at-line ()
"Visit the log of the revision at line.
@@ -559,6 +560,8 @@ the file in question, search for the log entry required and move point."
(message "Cannot extract revision number from the current line")
(let ((backend vc-annotate-backend)
(log-buf (get-buffer "*vc-change-log*"))
+ ;; No need to follow renames: we specify the historical file name.
+ vc-git-print-log-follow
pos)
(if (and
log-buf
@@ -607,7 +610,8 @@ the file in question, search for the log entry required and move point."
(vc-annotate-show-diff-revision-at-line-internal t))
(defun vc-annotate-show-changeset-diff-revision-at-line ()
- "Visit the diff of the revision at line from its previous revision for all files in the changeset."
+ "Show the diffs of revision at current line relative to previous revision.
+This is done for all files in changeset."
(interactive)
(when (eq 'file (vc-call-backend vc-annotate-backend 'revision-granularity))
(error "The %s backend does not support changeset diffs" vc-annotate-backend))
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index de5a90dc602..48fedeca5a8 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -467,7 +467,7 @@ in the branch repository (or whose status not be determined)."
;; Erase the status text that matched.
(delete-region (match-beginning 0) (match-end 0))
(setq status
- (intern (replace-regexp-in-string " " "" statusword)))))
+ (intern (string-replace " " "" statusword)))))
(when status
(goto-char (point-min))
(skip-chars-forward " \n\t") ;Throw away spaces.
@@ -634,7 +634,7 @@ Returns nil if unable to find this information."
(error "Don't know how to compute the next revision of %s" rev)))
(defun vc-bzr-register (files &optional _comment)
- "Register FILES under bzr. COMMENT is ignored."
+ "Register FILES under bzr. COMMENT is ignored."
(vc-bzr-command "add" nil 0 files))
;; Could run `bzr status' in the directory and see if it succeeds, but
@@ -1054,7 +1054,8 @@ stream. Standard error output is discarded."
(vc-bzr-command "info" t 0 dir)
(buffer-string)))
(shelve (vc-bzr-shelve-list))
- (shelve-help-echo "Use M-x vc-bzr-shelve to create shelves")
+ (shelve-help-echo (substitute-command-keys
+ "Use \\[vc-bzr-shelve] to create shelves"))
(root-dir (vc-bzr-root dir))
(pending-merge
;; FIXME: looking for .bzr/checkout/merge-hashes is not a
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index ef607133e86..6f921ac2a04 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -24,9 +24,9 @@
;;; Code:
+(require 'vc-rcs)
(eval-when-compile (require 'vc))
-(declare-function vc-branch-p "vc" (rev))
(declare-function vc-checkout "vc" (file &optional rev))
(declare-function vc-expand-dirs "vc" (file-or-dir-list backend))
(declare-function vc-read-revision "vc"
@@ -451,17 +451,17 @@ REV is the revision to check out."
((string= first-revision "")
(setq status (vc-cvs-merge-news file)))
(t
- (if (not (vc-branch-p first-revision))
+ (if (not (vc-rcs-branch-p first-revision))
(setq second-revision
(vc-read-revision
"Second revision: "
(list file) 'CVS nil
- (concat (vc-branch-part first-revision) ".")))
+ (concat (vc-rcs-branch-part first-revision) ".")))
;; We want to merge an entire branch. Set revisions
;; accordingly, so that vc-cvs-merge understands us.
(setq second-revision first-revision)
;; first-revision must be the starting point of the branch
- (setq first-revision (vc-branch-part first-revision)))
+ (setq first-revision (vc-rcs-branch-part first-revision)))
(setq status (vc-cvs-merge file first-revision second-revision))))
status))
@@ -542,14 +542,12 @@ Will fail unless you have administrative privileges on the repo."
;;; History functions
;;;
-(declare-function vc-rcs-print-log-cleanup "vc-rcs" ())
;; Follows vc-cvs-command, which uses vc-do-command from vc-dispatcher.
(declare-function vc-exec-after "vc-dispatcher" (code))
(defun vc-cvs-print-log (files buffer &optional _shortlog _start-revision limit)
"Print commit log associated with FILES into specified BUFFER.
Remaining arguments are ignored."
- (require 'vc-rcs)
;; It's just the catenation of the individual logs.
(vc-cvs-command
buffer
@@ -827,7 +825,7 @@ individually should stay local."
(line-end-position))))))))
(defun vc-cvs-parse-uhp (path)
- "parse user@host/path into (user@host /path)"
+ "Parse user@host/path into (user@host /path)."
(if (string-match "\\([^/]+\\)\\(/.*\\)" path)
(list (match-string 1 path) (match-string 2 path))
(list nil path)))
@@ -1173,7 +1171,7 @@ is non-nil."
(mtime (file-attribute-modification-time (file-attributes file)))
(parsed-time (progn (require 'parse-time)
(parse-time-string (concat time " +0000")))))
- (cond ((and (not (string-match "\\+" time))
+ (cond ((and (not (string-search "+" time))
(decoded-time-second parsed-time)
;; Compare just the seconds part of the file time,
;; since CVS file time stamp resolution is just 1 second.
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 5fd8d8e5036..fe631ee09a7 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -96,8 +96,7 @@ If REV is non-nil, that is the revision to check out. If REV is the
empty string, that means to check ou tht ehead of the trunk.
If optional arg DESTFILE is given, it is an alternate filename to
-write the contents to.
-"
+write the contents to."
;; This should LOCK the resource.
)
@@ -106,8 +105,7 @@ write the contents to.
If optional arg CONTENTS-DONE is non-nil, then the contents of FILE
have already been reverted from a version backup, and this function
-only needs to update the status of URL within the backend.
-"
+only needs to update the status of URL within the backend."
;; Should do a GET if !contents_done
;; Should UNLOCK the file.
)
@@ -123,8 +121,7 @@ If REV1 is nil, use the current workfile version as the older version.
If REV2 is nil, use the current workfile contents as the nwer version.
It should return a status of either 0 (no differences found), or
-1 (either non-empty diff or the diff is run asynchronously).
-"
+1 (either non-empty diff or the diff is run asynchronously)."
;; We should do this asynchronously...
;; How would we do it at all, that is the question!
)
@@ -136,7 +133,7 @@ It should return a status of either 0 (no differences found), or
;; This should use url-dav-get-properties with a depth of `1' to get
;; all the properties.
(defun vc-dav-dir-state (_url)
- "find the version control state of all files in DIR in a fast way."
+ "Find the version control state of all files in DIR in a fast way."
)
(defun vc-dav-responsible-p (_url)
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index eb8cf8192c1..8165d5e09f1 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -374,7 +374,7 @@ See `run-hooks'."
"Keymap for directory buffer.")
(defmacro vc-dir-at-event (event &rest body)
- "Evaluate BODY with point located at event-start of EVENT.
+ "Evaluate BODY with point located at `event-start' of EVENT.
If BODY uses EVENT, it should be a variable,
otherwise it will be evaluated twice."
(let ((posn (make-symbol "vc-dir-at-event-posn")))
@@ -567,7 +567,7 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
(defun vc-dir-next-line (arg)
"Go to the next line.
-If a prefix argument is given, move by that many lines."
+With prefix argument ARG, move that many lines."
(interactive "p")
(with-no-warnings
(ewoc-goto-next vc-ewoc arg)
@@ -575,7 +575,7 @@ If a prefix argument is given, move by that many lines."
(defun vc-dir-previous-line (arg)
"Go to the previous line.
-If a prefix argument is given, move by that many lines."
+With prefix argument ARG, move that many lines."
(interactive "p")
(ewoc-goto-prev vc-ewoc arg)
(vc-dir-move-to-goal-column))
@@ -703,7 +703,7 @@ line."
(defun vc-dir-mark-all-files (arg)
"Mark all files with the same state as the current one.
-With a prefix argument mark all files (not directories).
+With prefix argument ARG, mark all files (not directories).
If the current entry is a directory, mark all child files.
The commands operate on files that are on the same state.
@@ -813,7 +813,7 @@ line."
(defun vc-dir-unmark-all-files (arg)
"Unmark all files with the same state as the current one.
-With a prefix argument unmark all files.
+With prefix argument ARG, unmark all files.
If the current entry is a directory, unmark all the child files.
The commands operate on files that are on the same state.
@@ -1015,8 +1015,11 @@ child files."
(nreverse result)))
(defun vc-dir-child-files-and-states ()
- "Return the list of conses (FILE . STATE) for child files of the current entry if it's a directory.
-If it is a file, return the corresponding cons for the file itself."
+ "Return the state of one or more files for the current entry.
+If the entry is a directory, return the list of states of its child
+files, where each file is described by a cons of the form (FILE . STATE).
+If the entry is a file, return a single cons cell (FILE . STATE) for
+that file."
(let* ((crt (ewoc-locate vc-ewoc))
(crt-data (ewoc-data crt))
result)
@@ -1113,33 +1116,33 @@ If it is a file, return the corresponding cons for the file itself."
(define-derived-mode vc-dir-mode special-mode "VC dir"
"Major mode for VC directory buffers.
-Marking/Unmarking key bindings and actions:
-m - mark a file/directory
+Marking/Unmarking key bindings and actions: \\<vc-dir-mode-map>
+\\[vc-dir-mark] - mark a file/directory
- if the region is active, mark all the files in region.
Restrictions: - a file cannot be marked if any parent directory is marked
- a directory cannot be marked if any child file or
directory is marked
-u - unmark a file/directory
+\\[vc-dir-unmark] - unmark a file/directory
- if the region is active, unmark all the files in region.
-M - if the cursor is on a file: mark all the files with the same state as
+\\[vc-dir-mark-all-files] - if the cursor is on a file: mark all the files with the same state as
the current file
- if the cursor is on a directory: mark all child files
- with a prefix argument: mark all files
-U - if the cursor is on a file: unmark all the files with the same state
+\\[vc-dir-unmark-all-files] - if the cursor is on a file: unmark all the files with the same state
as the current file
- if the cursor is on a directory: unmark all child files
- with a prefix argument: unmark all files
VC commands
-VC commands in the `C-x v' prefix can be used.
+VC commands in the \\[vc-prefix-map] prefix can be used.
VC commands act on the marked entries. If nothing is marked, VC
commands act on the current entry.
Search & Replace
-S - searches the marked files
-Q - does a query replace on the marked files
-M-s a C-s - does an isearch on the marked files
-M-s a C-M-s - does a regexp isearch on the marked files
+\\[vc-dir-search] - searches the marked files
+\\[vc-dir-query-replace-regexp] - does a query replace on the marked files
+\\[vc-dir-isearch] - does an isearch on the marked files
+\\[vc-dir-isearch-regexp] - does a regexp isearch on the marked files
If nothing is marked, these commands act on the current entry.
When a directory is current or marked, the Search & Replace
commands act on the child files of that directory that are displayed in
@@ -1181,7 +1184,7 @@ specific headers."
"\n"))
(defun vc-dir-refresh-files (files)
- "Refresh some files in the *VC-dir* buffer."
+ "Refresh some FILES in the *VC-dir* buffer."
(let ((def-dir default-directory)
(backend vc-dir-backend))
(vc-set-mode-line-busy-indicator)
@@ -1542,7 +1545,7 @@ This implements the `bookmark-make-record-function' type for
;;;###autoload
(defun vc-dir-bookmark-jump (bmk)
- "Provides the bookmark-jump behavior for a `vc-dir' buffer.
+ "Provide the `bookmark-jump' behavior for a `vc-dir' buffer.
This implements the `handler' function interface for the record
type returned by `vc-dir-bookmark-make-record'."
(let* ((file (bookmark-prop-get bmk 'filename))
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index c29458620e9..346974bdba8 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -104,12 +104,13 @@
;; will be called with the buffer file name as argument whenever the
;; dispatcher resyncs the buffer.
-;; To do:
-;;
+;;; Code:
+
+;; TODO:
;; - log buffers need font-locking.
-;;
;; General customization
+
(defcustom vc-logentry-check-hook nil
"Normal hook run by `vc-finish-logentry'.
Use this to impose your own rules on the entry in addition to any the
@@ -403,7 +404,7 @@ Display the buffer in some window, but don't select it."
(defvar compilation-error-regexp-alist)
(defun vc-compilation-mode (backend)
- "Setup `compilation-mode' after with the appropriate `compilation-error-regexp-alist'."
+ "Setup `compilation-mode' with the appropriate `compilation-error-regexp-alist'."
(require 'compile)
(let* ((error-regexp-alist
(vc-make-backend-sym backend 'error-regexp-alist))
@@ -662,7 +663,7 @@ contents of the log entry buffer. If COMMENT is a string and
INITIAL-CONTENTS is nil, do action immediately as if the user had
entered COMMENT. If COMMENT is t, also do action immediately with an
empty comment. Remember the file's buffer in `vc-parent-buffer'
-\(current one if no file). Puts the log-entry buffer in major-mode
+\(current one if no file). Puts the log-entry buffer in major mode
MODE, defaulting to `log-edit-mode' if MODE is nil.
AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'.
BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer."
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 143087122fd..3f89fad2351 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -242,6 +242,20 @@ included in the completions."
;;;###autoload (load "vc-git" nil t)
;;;###autoload (vc-git-registered file))))
+;; Good example of file name that needs this: "test[56].xx".
+(defun vc-git--literal-pathspec (file)
+ "Prepend :(literal) path magic to FILE."
+ (when file
+ ;; Expand abbreviated file names.
+ (when (file-name-absolute-p file)
+ (setq file (expand-file-name file)))
+ (concat ":(literal)" (file-local-name file))))
+
+(defun vc-git--literal-pathspecs (files)
+ "Prepend :(literal) path magic to FILES."
+ (unless (vc-git--file-list-is-rootdir files)
+ (mapcar #'vc-git--literal-pathspec files)))
+
(defun vc-git-registered (file)
"Check whether FILE is registered with git."
(let ((dir (vc-git-root file)))
@@ -255,12 +269,12 @@ included in the completions."
(name (file-relative-name file dir))
(str (with-demoted-errors "Error: %S"
(cd dir)
- (vc-git--out-ok "ls-files" "-c" "-z" "--" name)
+ (vc-git--out-ok "ls-files" "-c" "-z" "--" (vc-git--literal-pathspec name))
;; If result is empty, use ls-tree to check for deleted
;; file.
(when (eq (point-min) (point-max))
(vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD"
- "--" name))
+ "--" (vc-git--literal-pathspec name)))
(buffer-string))))
(and str
(> (length str) (length name))
@@ -342,7 +356,7 @@ in the order given by `git status'."
,@(when (version<= "1.7.6.3" (vc-git--program-version))
'("--ignored"))
"--"))
- (status (apply #'vc-git--run-command-string file args)))
+ (status (apply #'vc-git--run-command-string (vc-git--literal-pathspec file) args)))
(if (null status)
;; If status is nil, there was an error calling git, likely because
;; the file is not in a git repo.
@@ -393,7 +407,7 @@ in the order given by `git status'."
orig-name) ;; Original name for renames or copies.
(defun vc-git-escape-file-name (name)
- "Escape a file name if necessary."
+ "Escape filename NAME if necessary."
(if (string-match "[\n\t\"\\]" name)
(concat "\""
(mapconcat (lambda (c)
@@ -620,28 +634,28 @@ or an empty string if none."
(pcase (vc-git-dir-status-state->stage git-state)
('update-index
(if files
- (vc-git-command (current-buffer) 'async files "add" "--refresh" "--")
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files) "add" "--refresh" "--")
(vc-git-command (current-buffer) 'async nil
"update-index" "--refresh")))
('ls-files-added
- (vc-git-command (current-buffer) 'async files
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files)
"ls-files" "-z" "-c" "-s" "--"))
('ls-files-up-to-date
- (vc-git-command (current-buffer) 'async files
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files)
"ls-files" "-z" "-c" "-s" "--"))
('ls-files-conflict
- (vc-git-command (current-buffer) 'async files
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files)
"ls-files" "-z" "-u" "--"))
('ls-files-unknown
- (vc-git-command (current-buffer) 'async files
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files)
"ls-files" "-z" "-o" "--exclude-standard" "--"))
('ls-files-ignored
- (vc-git-command (current-buffer) 'async files
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files)
"ls-files" "-z" "-o" "-i" "--directory"
"--no-empty-directory" "--exclude-standard" "--"))
;; --relative added in Git 1.5.5.
('diff-index
- (vc-git-command (current-buffer) 'async files
+ (vc-git-command (current-buffer) 'async (vc-git--literal-pathspecs files)
"diff-index" "--relative" "-z" "-M" "HEAD" "--")))
(vc-run-delayed
(vc-git-after-dir-status-stage git-state))))
@@ -869,12 +883,12 @@ The car of the list is the current branch."
(when flist
(vc-git-command nil 0 flist "update-index" "--add" "--"))
(when dlist
- (vc-git-command nil 0 dlist "add"))))
+ (vc-git-command nil 0 (vc-git--literal-pathspecs dlist) "add"))))
(defalias 'vc-git-responsible-p #'vc-git-root)
(defun vc-git-unregister (file)
- (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
+ (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--cached" "--"))
(declare-function log-edit-mode "log-edit" ())
(declare-function log-edit-toggle-header "log-edit" (header value))
@@ -882,8 +896,7 @@ The car of the list is the current branch."
(declare-function log-edit--toggle-amend "log-edit" (last-msg-fn))
(defun vc-git-log-edit-toggle-signoff ()
- "Toggle whether to add the \"Signed-off-by\" line at the end of
-the commit message."
+ "Toggle whether to add the \"Signed-off-by\" line at the end of commit message."
(interactive)
(log-edit-toggle-header "Sign-Off" "yes"))
@@ -941,7 +954,7 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
(lambda (value) (when (equal value "yes") (list argument)))))
;; When operating on the whole tree, better pass "-a" than ".", since "."
;; fails when we're committing a merge.
- (apply #'vc-git-command nil 0 (if only files)
+ (apply #'vc-git-command nil 0 (if only (vc-git--literal-pathspecs files))
(nconc (if msg-file (list "commit" "-F"
(file-local-name msg-file))
(list "commit" "-m"))
@@ -968,7 +981,7 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
(coding-system-for-write 'binary)
(fullname
(let ((fn (vc-git--run-command-string
- file "ls-files" "-z" "--full-name" "--")))
+ (vc-git--literal-pathspec file) "ls-files" "-z" "--full-name" "--")))
;; ls-files does not return anything when looking for a
;; revision of a file that has been renamed or removed.
(if (string= fn "")
@@ -985,14 +998,14 @@ It is based on `log-edit-mode', and has Git-specific extensions.")
(vc-git-root file)))
(defun vc-git-checkout (file &optional rev)
- (vc-git-command nil 0 file "checkout" (or rev "HEAD")))
+ (vc-git-command nil 0 (vc-git--literal-pathspec file) "checkout" (or rev "HEAD")))
(defun vc-git-revert (file &optional contents-done)
"Revert FILE to the version stored in the git repository."
(if contents-done
(vc-git-command nil 0 file "update-index" "--")
- (vc-git-command nil 0 file "reset" "-q" "--")
- (vc-git-command nil nil file "checkout" "-q" "--")))
+ (vc-git-command nil 0 (vc-git--literal-pathspec file) "reset" "-q" "--")
+ (vc-git-command nil nil (vc-git--literal-pathspec file) "checkout" "-q" "--")))
(defvar vc-git-error-regexp-alist
'(("^ \\(.+\\)\\> *|" 1 nil nil 0))
@@ -1076,7 +1089,7 @@ This prompts for a branch to merge from."
(defun vc-git-conflicted-files (directory)
"Return the list of files with conflicts in DIRECTORY."
(let* ((status
- (vc-git--run-command-string directory "status" "--porcelain" "--"))
+ (vc-git--run-command-string (vc-git--literal-pathspec directory) "status" "--porcelain" "--"))
(lines (when status (split-string status "\n" 'omit-nulls)))
files)
(dolist (line lines files)
@@ -1133,6 +1146,14 @@ This prompts for a branch to merge from."
(autoload 'vc-setup-buffer "vc-dispatcher")
+;; It's a weird option due to how Git handles '--follow', and it can
+;; hide certain (usually merge) commits in the `vc-print-log' buffers.
+;;
+;; (setq vc-git-log-switches '("-m")) can fix that, but at the cost of
+;; duplicating many merge commits in the log.
+;;
+;; Long explanation here:
+;; https://stackoverflow.com/questions/46487476/git-log-follow-graph-skips-commits
(defcustom vc-git-print-log-follow nil
"If true, follow renames in Git logs for a single file."
:type 'boolean
@@ -1157,7 +1178,7 @@ If LIMIT is a revision string, use it as an end-revision."
(let ((inhibit-read-only t))
(with-current-buffer buffer
(apply #'vc-git-command buffer
- 'async files
+ 'async (vc-git--literal-pathspecs files)
(append
'("log" "--no-color")
(when (and vc-git-print-log-follow
@@ -1302,7 +1323,7 @@ or BRANCH^ (where \"^\" can be repeated)."
(defun vc-git-expanded-log-entry (revision)
(with-temp-buffer
- (apply #'vc-git-command t nil nil (list "log" revision "-1" "--"))
+ (apply #'vc-git-command t nil nil (list "log" revision "-1" "--no-color" "--"))
(goto-char (point-min))
(unless (eobp)
;; Indent the expanded log entry.
@@ -1322,7 +1343,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
;; but since Git is one of the two backends that support this operation
;; so far, it's hard to tell; hg doesn't need this.
(with-temp-buffer
- (vc-call-backend 'git 'diff file "HEAD" nil (current-buffer))
+ (vc-call-backend 'git 'diff (list file) "HEAD" nil (current-buffer))
(goto-char (point-min))
(let ((last-offset 0)
(from-offset nil)
@@ -1408,7 +1429,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(if vc-git-diff-switches
(apply #'vc-git-command (or buffer "*vc-diff*")
1 ; bug#21969
- files
+ (vc-git--literal-pathspecs files)
command
"--exit-code"
(append (vc-switches 'git 'diff)
@@ -1493,7 +1514,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(let* ((fname (file-relative-name file))
(prev-rev (with-temp-buffer
(and
- (vc-git--out-ok "rev-list" "-2" rev "--" fname)
+ (vc-git--out-ok "rev-list" "-2" rev "--" (vc-git--literal-pathspec fname))
(goto-char (point-max))
(bolp)
(zerop (forward-line -1))
@@ -1521,7 +1542,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(current-rev
(with-temp-buffer
(and
- (vc-git--out-ok "rev-list" "-1" rev "--" file)
+ (vc-git--out-ok "rev-list" "-1" rev "--" (vc-git--literal-pathspec file))
(goto-char (point-max))
(bolp)
(zerop (forward-line -1))
@@ -1533,7 +1554,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(and current-rev
(with-temp-buffer
(and
- (vc-git--out-ok "rev-list" "HEAD" "--" file)
+ (vc-git--out-ok "rev-list" "HEAD" "--" (vc-git--literal-pathspec file))
(goto-char (point-min))
(search-forward current-rev nil t)
(zerop (forward-line -1))
@@ -1543,13 +1564,13 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"."
(or (vc-git-symbolic-commit next-rev) next-rev)))
(defun vc-git-delete-file (file)
- (vc-git-command nil 0 file "rm" "-f" "--"))
+ (vc-git-command nil 0 (vc-git--literal-pathspec file) "rm" "-f" "--"))
(defun vc-git-rename-file (old new)
(vc-git-command nil 0 (list old new) "mv" "-f" "--"))
(defun vc-git-mark-resolved (files)
- (vc-git-command nil 0 files "add"))
+ (vc-git-command nil 0 (vc-git--literal-pathspecs files) "add"))
(defvar vc-git-extra-menu-map
(let ((map (make-sparse-keymap)))
@@ -1598,8 +1619,8 @@ before it is executed.
With two \\[universal-argument] prefixes, directly edit and run `grep-command'.
Collect output in a buffer. While git grep runs asynchronously, you
-can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \
-in the grep output buffer,
+can use \\[next-error] (`next-error'), or \\<grep-mode-map>\
+\\[compile-goto-error] in the grep output buffer,
to go to the lines where grep found matches.
This command shares argument histories with \\[rgrep] and \\[grep]."
@@ -1772,22 +1793,24 @@ The difference to vc-do-command is that this function always invokes
(process-environment
(append
`("GIT_DIR"
- "GIT_LITERAL_PATHSPECS=1"
;; Avoid repository locking during background operations
;; (bug#21559).
,@(when revert-buffer-in-progress-p
'("GIT_OPTIONAL_LOCKS=0")))
process-environment)))
(apply #'vc-do-command (or buffer "*vc*") okstatus vc-git-program
- ;; https://debbugs.gnu.org/16897
- (unless (and (not (cdr-safe file-or-list))
- (let ((file (or (car-safe file-or-list)
- file-or-list)))
- (and file
- (eq ?/ (aref file (1- (length file))))
- (equal file (vc-git-root file)))))
- file-or-list)
- (cons "--no-pager" flags))))
+ ;; https://debbugs.gnu.org/16897
+ (unless (vc-git--file-list-is-rootdir file-or-list)
+ file-or-list)
+ (cons "--no-pager" flags))))
+
+(defun vc-git--file-list-is-rootdir (file-or-list)
+ (and (not (cdr-safe file-or-list))
+ (let ((file (or (car-safe file-or-list)
+ file-or-list)))
+ (and file
+ (eq ?/ (aref file (1- (length file))))
+ (equal file (vc-git-root file))))))
(defun vc-git--empty-db-p ()
"Check if the git db is empty (no commit done yet)."
@@ -1807,7 +1830,6 @@ The difference to vc-do-command is that this function always invokes
(process-environment
(append
`("GIT_DIR"
- "GIT_LITERAL_PATHSPECS=1"
;; Avoid repository locking during background operations
;; (bug#21559).
,@(when revert-buffer-in-progress-p
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index c9c1e91d483..6bec9edbf35 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -137,8 +137,7 @@ switches."
:version "25.1")
(defcustom vc-hg-revert-switches nil
- "String or list of strings specifying switches for hg revert
-under VC."
+ "String or list of strings specifying switches for hg revert under VC."
:type '(choice (const :tag "None" nil)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
@@ -271,9 +270,9 @@ If `ask', you will be prompted for a branch type."
(defcustom vc-hg-symbolic-revision-styles
'(builtin-active-bookmark
"{if(bookmarks,sub(' ',',',bookmarks),if(phabdiff,phabdiff,shortest(node,6)))}")
- "List of ways to present versions symbolically. The version
-that we use is the first one that successfully produces a
-non-empty string.
+ "List of ways to present versions symbolically.
+The version that we use is the first one that successfully
+produces a non-empty string.
Each entry in the list can be either:
@@ -291,7 +290,7 @@ and an optional path to which to limit history) and produce a
string. The function is called with `default-directory' set to
within the repository.
-If no list entry produces a useful revision, return `nil'."
+If no list entry produces a useful revision, return nil."
:type '(repeat (choice
(const :tag "Active bookmark" builtin-active-bookmark)
(string :tag "Hg template")
@@ -301,7 +300,7 @@ If no list entry produces a useful revision, return `nil'."
(defcustom vc-hg-use-file-version-for-mode-line-version nil
"When enabled, the modeline contains revision information for the visited file.
When not, the revision in the modeline is for the repository
-working copy. `nil' is the much faster setting for
+working copy. nil is the much faster setting for
large repositories."
:type 'boolean
:version "26.1")
@@ -643,8 +642,8 @@ Variable `vc-hg-create-bookmark' controls what kind of branch will be created."
;;; Native data structure reading
(defcustom vc-hg-parse-hg-data-structures t
- "If true, try directly parsing Mercurial data structures
-directly instead of always running Mercurial. We try to be safe
+ "If true, try parsing Mercurial data structures directly.
+This is done instead of always running Mercurial. We try to be safe
against Mercurial data structure format changes and always fall
back to running Mercurial directly."
:type 'boolean
@@ -673,7 +672,6 @@ Return the byte's value as an integer."
(let* ((result nil)
(flen (length fname))
(case-fold-search nil)
- (inhibit-changing-match-data t)
;; Find a conservative bound for the loop below by using
;; Boyer-Moore on the raw dirstate without parsing it; we
;; know we can't possibly find fname _after_ the last place
@@ -811,7 +809,7 @@ if we don't understand a construct, we signal
(push c parts)
(cond ((eq c ?\\) (setf state 'charclass-backslash))
((eq c ?\]) (setf state 'normal))))
- (t (error "invalid state")))
+ (t (error "Invalid state")))
(setf i (1+ i))))
(unless (eq state 'normal)
(signal 'vc-hg-unsupported-syntax (list pcre)))
@@ -851,8 +849,8 @@ if we don't understand a construct, we signal
(push "\\[" parts))
(t
(let ((x (substring glob i j)))
- (setf x (replace-regexp-in-string
- "\\\\" "\\\\" x t t))
+ (setf x (string-replace
+ "\\" "\\\\" x))
(setf i (1+ j))
(cond ((eq (aref x 0) ?!)
(setf (aref x 0) ?^))
@@ -977,10 +975,9 @@ REPO must be the directory name of an hg repository."
"Test whether the ignore pattern set HGIP says to ignore FILENAME.
FILENAME must be the file's true absolute name."
(let ((patterns (vc-hg--ignore-patterns-ignore-patterns hgip))
- (inhibit-changing-match-data t)
(ignored nil))
(while (and patterns (not ignored))
- (setf ignored (string-match (pop patterns) filename)))
+ (setf ignored (string-match-p (pop patterns) filename)))
ignored))
(defvar vc-hg--cached-ignore-patterns nil
@@ -1017,9 +1014,9 @@ FILENAME must be the file's true absolute name."
"remotefilelog"
"revlogv1"
"store")
- "List of Mercurial repository requirements we understand; if a
-repository requires features not present in this list, we avoid
-attempting to parse Mercurial data structures.")
+ "List of Mercurial repository requirements we understand.
+If a repository requires features not present in this list, we
+avoid attempting to parse Mercurial data structures.")
(defun vc-hg--requirements-understood-p (repo)
"Check that we understand the format of the given repository.
@@ -1044,7 +1041,8 @@ Avoids the need to repeatedly scan dirstate on repeated calls to
(equal size (pop cache))
(equal ascii-fname (pop cache)))
(pop cache)
- (let ((result (vc-hg--raw-dirstate-search dirstate ascii-fname)))
+ (let ((result (save-match-data
+ (vc-hg--raw-dirstate-search dirstate ascii-fname))))
(setf vc-hg--dirstate-scan-cache
(list dirstate mtime size ascii-fname result))
result))))
@@ -1151,7 +1149,7 @@ hg binary."
(expand-file-name old)))
(defun vc-hg-register (files &optional _comment)
- "Register FILES under hg. COMMENT is ignored."
+ "Register FILES under hg. COMMENT is ignored."
(vc-hg-command nil 0 files "add"))
(defun vc-hg-create-repo ()
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 4b3c829a2c6..cd5b11d840b 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -256,9 +256,9 @@ It is usually called via the `vc-call' macro."
(defmacro vc-call (fun file &rest args)
"A convenience macro for calling VC backend functions.
Functions called by this macro must accept FILE as the first argument.
-ARGS specifies any additional arguments. FUN should be unquoted.
-BEWARE!! FILE is evaluated twice!!"
- `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args))
+ARGS specifies any additional arguments. FUN should be unquoted."
+ (macroexp-let2 nil file file
+ `(vc-call-backend (vc-backend ,file) ',fun ,file ,@args)))
(defsubst vc-parse-buffer (pattern i)
"Find PATTERN in the current buffer and return its Ith submatch."
@@ -483,7 +483,7 @@ status of this file. Otherwise, the value returned is one of:
(vc-call-backend backend 'state file)))
(defsubst vc-up-to-date-p (file)
- "Convenience function that checks whether `vc-state' of FILE is `up-to-date'."
+ "Convenience function to check whether `vc-state' of FILE is `up-to-date'."
(eq (vc-state file) 'up-to-date))
(defun vc-working-revision (file &optional backend)
@@ -627,7 +627,7 @@ Before doing that, check if there are any old backups and get rid of them."
(declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
-(defvar vc-dir-buffers nil "List of vc-dir buffers.")
+(defvar vc-dir-buffers nil "List of `vc-dir' buffers.")
(defun vc-after-save ()
"Function to be called by `basic-save-buffer' (in files.el)."
@@ -864,7 +864,8 @@ In the latter case, VC mode is deactivated for this buffer."
(defvar vc-prefix-map
(let ((map (make-sparse-keymap)))
(define-key map "a" #'vc-update-change-log)
- (define-key map "b" #'vc-switch-backend)
+ (with-suppressed-warnings ((obsolete vc-switch-backend))
+ (define-key map "b" #'vc-switch-backend))
(define-key map "d" #'vc-dir)
(define-key map "g" #'vc-annotate)
(define-key map "G" #'vc-ignore)
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 6ffc1a8a2ff..e38469ba9f0 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -41,7 +41,6 @@
(require 'cl-lib)
(require 'vc))
-(declare-function vc-branch-p "vc" (rev))
(declare-function vc-read-revision "vc"
(prompt &optional files backend default initial-input))
(declare-function vc-buffer-context "vc-dispatcher" ())
@@ -173,6 +172,19 @@ For a description of possible values, see `vc-check-master-templates'."
(defun vc-rcs-dir-extra-headers (&rest _ignore))
+;; functions that operate on RCS revision numbers.
+(defun vc-rcs-branch-p (rev)
+ "Return t if REV is a branch revision."
+ (not (eq nil (string-match "\\`[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*\\'" rev))))
+(define-obsolete-function-alias 'vc-branch-p #'vc-rcs-branch-p "28.1")
+
+(defun vc-rcs-branch-part (rev)
+ "Return the branch part of a revision number REV."
+ (let ((index (string-match "\\.[0-9]+\\'" rev)))
+ (when index
+ (substring rev 0 index))))
+(define-obsolete-function-alias 'vc-branch-part #'vc-rcs-branch-part "28.1")
+
(defun vc-rcs-working-revision (file)
"RCS-specific version of `vc-working-revision'."
(or (and vc-consult-headers
@@ -198,7 +210,7 @@ When VERSION is given, perform check for that version."
;; If we are not on the trunk, we need to examine the
;; whole current branch.
(vc-insert-file (vc-master-name file) "^desc")
- (vc-rcs-find-most-recent-rev (vc-branch-part version))))))
+ (vc-rcs-find-most-recent-rev (vc-rcs-branch-part version))))))
(defun vc-rcs-workfile-unchanged-p (file)
"Has FILE remained unchanged since last checkout?"
@@ -230,7 +242,7 @@ When VERSION is given, perform check for that version."
(autoload 'vc-switches "vc")
(defun vc-rcs-register (files &optional comment)
- "Register FILES into the RCS version-control system.
+ "Register FILES into the RCS version control system.
Automatically retrieve a read-only version of the file with keywords expanded.
COMMENT can be used to provide an initial description for each FILES.
Passes either `vc-rcs-register-switches' or `vc-register-switches'
@@ -326,7 +338,7 @@ whether to remove it."
(setq rev default-branch)
(setq switches (cons "-f" switches)))
(if (and (not rev) old-version)
- (setq rev (vc-branch-part old-version)))
+ (setq rev (vc-rcs-branch-part old-version)))
(apply #'vc-do-command "*vc*" 0 "ci" (vc-master-name file)
;; if available, use the secure check-in option
(and (vc-rcs-release-p "5.6.4") "-j")
@@ -349,11 +361,11 @@ whether to remove it."
;; branch accordingly
(cond
((and old-version new-version
- (not (string= (vc-branch-part old-version)
- (vc-branch-part new-version))))
+ (not (string= (vc-rcs-branch-part old-version)
+ (vc-rcs-branch-part new-version))))
(vc-rcs-set-default-branch file
(if (vc-rcs-trunk-p new-version) nil
- (vc-branch-part new-version)))
+ (vc-rcs-branch-part new-version)))
;; If this is an old (pre-1992!) RCS release, we might have
;; to remove a remaining lock.
(if (not (vc-rcs-release-p "5.6.2"))
@@ -370,8 +382,9 @@ whether to remove it."
(vc-switches 'RCS 'checkout)))
(defun vc-rcs-checkout (file &optional rev)
- "Retrieve a copy of a saved version of FILE. If FILE is a directory,
-attempt the checkout for all registered files beneath it."
+ "Retrieve a copy of a saved version of FILE.
+If FILE is a directory, attempt the checkout for all registered
+files beneath it."
(if (file-directory-p file)
(mapc #'vc-rcs-checkout (vc-expand-dirs (list file) 'RCS))
(let ((file-buffer (get-file-buffer file))
@@ -414,7 +427,7 @@ attempt the checkout for all registered files beneath it."
;; REV is t ...
(if (not (vc-rcs-trunk-p workrev))
;; ... go to head of current branch
- (vc-branch-part workrev)
+ (vc-rcs-branch-part workrev)
;; ... go to head of trunk
(vc-rcs-set-default-branch file
nil)
@@ -431,13 +444,13 @@ attempt the checkout for all registered files beneath it."
file
(if (vc-rcs-latest-on-branch-p file new-version)
(if (vc-rcs-trunk-p new-version) nil
- (vc-branch-part new-version))
+ (vc-rcs-branch-part new-version))
new-version)))))
(message "Checking out %s...done" file))))))
(defun vc-rcs-revert (file &optional _contents-done)
- "Revert FILE to the version it was based on. If FILE is a directory,
-revert all registered files beneath it."
+ "Revert FILE to the version it was based on.
+If FILE is a directory, revert all registered files beneath it."
(if (file-directory-p file)
(mapc #'vc-rcs-revert (vc-expand-dirs (list file) 'RCS))
(vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f"
@@ -456,17 +469,17 @@ revert all registered files beneath it."
((string= first-revision "")
(error "A starting RCS revision is required"))
(t
- (if (not (vc-branch-p first-revision))
+ (if (not (vc-rcs-branch-p first-revision))
(setq second-revision
(vc-read-revision
"Second RCS revision: "
(list file) 'RCS nil
- (concat (vc-branch-part first-revision) ".")))
+ (concat (vc-rcs-branch-part first-revision) ".")))
;; We want to merge an entire branch. Set revisions
;; accordingly, so that vc-rcs-merge understands us.
(setq second-revision first-revision)
;; first-revision must be the starting point of the branch
- (setq first-revision (vc-branch-part first-revision)))))
+ (setq first-revision (vc-rcs-branch-part first-revision)))))
(vc-rcs-merge file first-revision second-revision)))
(defun vc-rcs-merge (file first-version &optional second-version)
@@ -504,8 +517,9 @@ Needs RCS 5.6.2 or later for -M."
(kill-buffer filename)))))
(defun vc-rcs-modify-change-comment (files rev comment)
- "Modify the change comments change on FILES on a specified REV. If FILE is a
-directory the operation is applied to all registered files beneath it."
+ "Modify the change comments change on FILES on a specified REV.
+If FILE is a directory the operation is applied to all registered
+files beneath it."
(dolist (file (vc-expand-dirs files 'RCS))
(vc-do-command "*vc*" 0 "rcs" (vc-master-name file)
(concat "-m" rev ":" comment))))
@@ -637,11 +651,11 @@ Optional arg REVISION is a revision to annotate from."
;; Find which branches (if any) must be included in the edits.
(let ((par revision)
bpt kids)
- (while (setq bpt (vc-branch-part par)
- par (vc-branch-part bpt))
+ (while (setq bpt (vc-rcs-branch-part par)
+ par (vc-rcs-branch-part bpt))
(setq kids (cdr (assq 'branches (cdr (assoc par revisions)))))
;; A branchpoint may have multiple children. Find the right one.
- (while (not (string= bpt (vc-branch-part (car kids))))
+ (while (not (string= bpt (vc-rcs-branch-part (car kids))))
(setq kids (cdr kids)))
(push (cons par (car kids)) nbls)))
;; Start with the full text.
@@ -818,7 +832,7 @@ systime, or nil if there is none. Also, reposition point."
or nil if there is no previous revision. This default
implementation works for MAJOR.MINOR-style revision numbers as
used by RCS and CVS."
- (let ((branch (vc-branch-part rev))
+ (let ((branch (vc-rcs-branch-part rev))
(minor-num (string-to-number (vc-rcs-minor-part rev))))
(when branch
(if (> minor-num 1)
@@ -830,7 +844,7 @@ used by RCS and CVS."
nil
;; we are at the beginning of a branch --
;; return revision of starting point
- (vc-branch-part branch))))))
+ (vc-rcs-branch-part branch))))))
(defun vc-rcs-next-revision (file rev)
"Return the revision number immediately following REV for FILE,
@@ -838,7 +852,7 @@ or nil if there is no next revision. This default implementation
works for MAJOR.MINOR-style revision numbers as used by RCS
and CVS."
(when (not (string= rev (vc-working-revision file)))
- (let ((branch (vc-branch-part rev))
+ (let ((branch (vc-rcs-branch-part rev))
(minor-num (string-to-number (vc-rcs-minor-part rev))))
(concat branch "." (number-to-string (1+ minor-num))))))
@@ -965,7 +979,7 @@ to its master version."
(setq latest-rev rev)
(setq value (match-string 1)))))
(or value
- (vc-branch-part branch))))
+ (vc-rcs-branch-part branch))))
(defun vc-rcs-fetch-master-state (file &optional working-revision)
"Compute the master file's idea of the state of FILE.
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 92cce5f13a8..bcbb87eba8e 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -191,7 +191,7 @@ Optional string REV is a revision."
(autoload 'vc-switches "vc")
(defun vc-sccs-register (files &optional comment)
- "Register FILES into the SCCS version-control system.
+ "Register FILES into the SCCS version control system.
Automatically retrieve a read-only version of the files with keywords expanded.
COMMENT can be used to provide an initial description of FILES.
Passes either `vc-sccs-register-switches' or `vc-register-switches'
@@ -270,8 +270,8 @@ locked. REV is the revision to check out."
(message "Checking out %s...done" file))))
(defun vc-sccs-revert (file &optional _contents-done)
- "Revert FILE to the version it was based on. If FILE is a directory,
-revert all subfiles."
+ "Revert FILE to the version it was based on.
+If FILE is a directory, revert all subfiles."
(if (file-directory-p file)
(mapc #'vc-sccs-revert (vc-expand-dirs (list file) 'SCCS))
(vc-sccs-do-command nil 0 "unget" (vc-master-name file))
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index faba5bce2b7..b408b7de760 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -238,7 +238,7 @@ This function differs from vc-do-command in that it invokes `vc-src-program'."
(autoload 'vc-switches "vc")
(defun vc-src-register (files &optional _comment)
- "Register FILES under src. COMMENT is ignored."
+ "Register FILES under src. COMMENT is ignored."
(vc-src-command nil files "add"))
(defun vc-src-responsible-p (file)
@@ -268,15 +268,16 @@ REV is the revision to check out into WORKFILE."
(vc-src-command nil file "co")))
(defun vc-src-revert (file &optional _contents-done)
- "Revert FILE to the version it was based on. If FILE is a directory,
-revert all registered files beneath it."
+ "Revert FILE to the version it was based on.
+If FILE is a directory, revert all registered files beneath it."
(if (file-directory-p file)
(mapc #'vc-src-revert (vc-expand-dirs (list file) 'SRC))
(vc-src-command nil file "co")))
(defun vc-src-modify-change-comment (files rev comment)
- "Modify the change comments change on FILES on a specified REV. If FILE is a
-directory the operation is applied to all registered files beneath it."
+ "Modify the change comments change on FILES on a specified REV.
+If FILE is a directory the operation is applied to all registered
+files beneath it."
(dolist (file (vc-expand-dirs files 'SRC))
(vc-src-command nil file "amend" "-m" comment rev)))
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index c30920dd157..e14519cc20e 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -192,7 +192,7 @@ switches."
(let ((state (cdr (assq (aref (match-string 1) 0) state-map)))
(propstat (cdr (assq (aref (match-string 2) 0) state-map)))
(filename (if (memq system-type '(windows-nt ms-dos))
- (replace-regexp-in-string "\\\\" "/" (match-string 4))
+ (string-replace "\\" "/" (match-string 4))
(match-string 4))))
(and (memq propstat '(conflict edited))
(not (eq state 'conflict)) ; conflict always wins
@@ -295,7 +295,7 @@ RESULT is a list of conses (FILE . STATE) for directory DIR."
(autoload 'vc-switches "vc")
(defun vc-svn-register (files &optional _comment)
- "Register FILES into the SVN version-control system.
+ "Register FILES into the SVN version control system.
The COMMENT argument is ignored This does an add but not a commit.
Passes either `vc-svn-register-switches' or `vc-register-switches'
to the SVN command."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9338b7191d0..4b56f1b795c 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -431,7 +431,7 @@
;; and displays a file name and a revision, then return a cons
;; (REVISION . FILENAME).
;;
-;; - region-history (FILE BUFFER LFROM LTO)
+;; - region-history (file buffer lfrom lto)
;;
;; Insert into BUFFER the history (log comments and diffs) of the content of
;; FILE between lines LFROM and LTO. This is typically done asynchronously.
@@ -486,11 +486,19 @@
;; from ignored files.
;; When called from Lisp code, if DIRECTORY is non-nil, the
;; repository to use will be deduced by DIRECTORY.
+;; The default behavior is to add or remove a line from the file
+;; returned by the `find-ignore-file' function.
;;
;; - ignore-completion-table (directory)
;;
;; Return the completion table for files ignored by the current
;; version control system, e.g., the entries in `.gitignore' and
+;; `.bzrignore'. The default behavior is to read the contents of
+;; the file returned by the `find-ignore-file' function.
+;;
+;; - find-ignore-file (file)
+;;
+;; Return the ignore file that controls FILE, e.g. `.gitignore' or
;; `.bzrignore'.
;;
;; - previous-revision (file rev)
@@ -507,7 +515,7 @@
;;
;; Turn on the mode used for editing the check in log. This
;; defaults to `log-edit-mode'. If changed, it should use a mode
-;; derived from`log-edit-mode'.
+;; derived from `log-edit-mode'.
;;
;; - check-headers ()
;;
@@ -731,6 +739,7 @@
(require 'cl-lib)
(declare-function diff-setup-whitespace "diff-mode" ())
+(declare-function diff-setup-buffer-type "diff-mode" ())
(eval-when-compile
(require 'dired))
@@ -852,7 +861,9 @@ See `run-hooks'."
(defcustom vc-revert-show-diff t
"If non-nil, `vc-revert' shows a `vc-diff' buffer before querying."
- :type 'boolean
+ :type '(choice (const :tag "Show and bury afterwards" t)
+ (const :tag "Show and kill afterwards" kill)
+ (const :tag "Don't show" nil))
:version "24.1")
;; Header-insertion hair
@@ -927,11 +938,18 @@ repository, prompting for the directory and the VC backend to
use."
(catch 'found
;; First try: find a responsible backend, it must be a backend
- ;; under which FILE is not yet registered.
- (dolist (backend vc-handled-backends)
- (and (not (vc-call-backend backend 'registered file))
- (vc-call-backend backend 'responsible-p file)
- (throw 'found backend)))
+ ;; under which FILE is not yet registered and with the most
+ ;; specific path to FILE.
+ (let ((max 0)
+ bk)
+ (dolist (backend vc-handled-backends)
+ (when (not (vc-call-backend backend 'registered file))
+ (let* ((path (vc-call-backend backend 'responsible-p file))
+ (len (length path)))
+ (when (and len (> len max))
+ (setq max len bk backend)))))
+ (when bk
+ (throw 'found bk)))
;; no responsible backend
(let* ((possible-backends
(let (pos)
@@ -1002,7 +1020,7 @@ responsible for the given file."
(error "No VC backend is responsible for %s" file))))
(defun vc-expand-dirs (file-or-dir-list backend)
- "Expands directories in a file list specification.
+ "Expand directories in a file list specification.
Within directories, only files already under version control are noticed."
(let ((flattened '()))
(dolist (node file-or-dir-list)
@@ -1142,15 +1160,17 @@ BEWARE: this function may change the current buffer."
(memq (vc-state file) '(edited needs-merge conflict))))))
(defun vc-compatible-state (p q)
- "Controls which states can be in the same commit."
+ "Control which states can be in the same commit."
(or
(eq p q)
(and (member p '(edited added removed)) (member q '(edited added removed)))))
-(defun vc-read-backend (prompt)
- (intern
- (completing-read prompt (mapcar #'symbol-name vc-handled-backends)
- nil 'require-match)))
+(defun vc-read-backend (prompt &optional backends default)
+ (let ((backends (or backends vc-handled-backends))
+ (completion-ignore-case t))
+ (intern
+ (completing-read prompt (mapcar #'symbol-name backends)
+ nil 'require-match nil nil default))))
;; Here's the major entry point.
@@ -1176,7 +1196,11 @@ For old-style locking-based version control systems, like RCS:
*vc-log* buffer to check in the changes. Leave a
read-only copy of each changed file after checking in.
If every file is locked by you and unchanged, unlock them.
- If every file is locked by someone else, offer to steal the lock."
+ If every file is locked by someone else, offer to steal the lock.
+
+When using this command to register a new file (or files), it
+will automatically deduce which VC repository to register it
+with, using the most specific one."
(interactive "P")
(let* ((vc-fileset (vc-deduce-fileset nil t 'state-model-only-files))
(backend (car vc-fileset))
@@ -1204,7 +1228,11 @@ For old-style locking-based version control systems, like RCS:
((eq state 'ignored)
(error "Fileset files are ignored by the version-control system"))
((or (null state) (eq state 'unregistered))
- (vc-register vc-fileset))
+ (cond (verbose
+ (let ((backend (vc-read-backend "Backend to register to: ")))
+ (vc-register (cons backend (cdr vc-fileset)))))
+ (t
+ (vc-register vc-fileset))))
;; Files are up-to-date, or need a merge and user specified a revision
((or (eq state 'up-to-date) (and verbose (eq state 'needs-update)))
(cond
@@ -1359,14 +1387,7 @@ For old-style locking-based version control systems, like RCS:
(defun vc-create-repo (backend)
"Create an empty repository in the current directory."
- (interactive
- (list
- (intern
- (upcase
- (completing-read
- "Create repository for: "
- (mapcar (lambda (b) (list (downcase (symbol-name b)))) vc-handled-backends)
- nil t)))))
+ (interactive (list (vc-read-backend "Create repository for: ")))
(vc-call-backend backend 'create-repo))
;;;###autoload
@@ -1719,6 +1740,7 @@ to override the value of `vc-diff-switches' and `diff-switches'."
(insert (cdr messages) ".\n")
(message "%s" (cdr messages))))
(diff-setup-whitespace)
+ (diff-setup-buffer-type)
(goto-char (point-min))
(when window
(shrink-window-if-larger-than-buffer window)))
@@ -1854,13 +1876,10 @@ Return t if the buffer had changes, nil otherwise."
(vc-working-revision first))))
(when (string= rev1-default "") (setq rev1-default nil))))
;; construct argument list
- (let* ((rev1-prompt (if rev1-default
- (concat "Older revision (default "
- rev1-default "): ")
- "Older revision: "))
- (rev2-prompt (concat "Newer revision (default "
- ;; (or rev2-default
- "current source): "))
+ (let* ((rev1-prompt (format-prompt "Older revision" rev1-default))
+ (rev2-prompt (format-prompt "Newer revision"
+ ;; (or rev2-default
+ "current source"))
(rev1 (vc-read-revision rev1-prompt files backend rev1-default))
(rev2 (vc-read-revision rev2-prompt files backend nil))) ;; rev2-default
(when (string= rev1 "") (setq rev1 nil))
@@ -2047,9 +2066,9 @@ saving the buffer."
;; here, this way the *vc-diff* buffer is setup correctly, so
;; relative file names work.
(let ((default-directory rootdir))
- (vc-diff-internal
- t (list backend (list rootdir) working-revision) nil nil
- (called-interactively-p 'interactive))))))
+ (vc-diff-internal
+ t (list backend (list rootdir) working-revision) nil nil
+ (called-interactively-p 'interactive))))))
;;;###autoload
(defun vc-root-dir ()
@@ -2073,7 +2092,7 @@ If `F.~REV~' already exists, use it instead of checking it out again."
(with-current-buffer (or (buffer-base-buffer) (current-buffer))
(vc-ensure-vc-buffer)
(list
- (vc-read-revision "Revision to visit (default is working revision): "
+ (vc-read-revision (format-prompt "Revision to visit" "working revision")
(list buffer-file-name)))))
(set-buffer (or (buffer-base-buffer) (current-buffer)))
(vc-ensure-vc-buffer)
@@ -2369,7 +2388,7 @@ This function runs the hook `vc-retrieve-tag-hook' when finished."
(read-directory-name "Directory: " default-directory nil t))))
(list
dir
- (vc-read-revision "Tag name to retrieve (default latest revisions): "
+ (vc-read-revision (format-prompt "Tag name to retrieve" "latest revisions")
(list dir)
(vc-responsible-backend dir)))))
(let* ((backend (vc-responsible-backend dir))
@@ -2615,7 +2634,7 @@ with its diffs (if the underlying VCS supports that)."
;;;###autoload
(defun vc-log-incoming (&optional remote-location)
- "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION.
+ "Show log of changes that will be received with pull from REMOTE-LOCATION.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION."
(interactive
(when current-prefix-arg
@@ -2628,7 +2647,7 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION."
;;;###autoload
(defun vc-log-outgoing (&optional remote-location)
- "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION.
+ "Show log of changes that will be sent with a push operation to REMOTE-LOCATION.
When called interactively with a prefix argument, prompt for REMOTE-LOCATION."
(interactive
(when current-prefix-arg
@@ -2749,7 +2768,7 @@ to the working revision (except for keyword expansion)."
(if (= nfiles 1) "" "s"))))))
(error "Revert canceled")))
(when diff-buffer
- (quit-windows-on diff-buffer)))
+ (quit-windows-on diff-buffer (eq vc-revert-show-diff 'kill))))
(dolist (file files)
(message "Reverting %s..." (vc-delistify files))
(vc-revert-file file)
@@ -2855,6 +2874,7 @@ permanent, only for the current session. This function only changes
VC's perspective on FILE, it does not register or unregister it.
By default, this command cycles through the registered backends.
To get a prompt, use a prefix argument."
+ (declare (obsolete nil "28.1"))
(interactive
(list
(or buffer-file-name
@@ -2874,12 +2894,7 @@ To get a prompt, use a prefix argument."
(cond
((null others) (error "No other backend to switch to"))
(current-prefix-arg
- (intern
- (upcase
- (completing-read
- (format "Switch to backend [%s]: " def)
- (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends)
- nil t nil nil (downcase (symbol-name def))))))
+ (vc-read-backend "Switch to backend: " backends (symbol-name def)))
(t def))))))
(unless (eq backend (vc-backend file))
(vc-file-clearprops file)
@@ -2914,7 +2929,8 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
(if registered
(set-file-modes file (logior (file-modes file) 128))
;; `registered' might have switched under us.
- (vc-switch-backend file old-backend)
+ (with-suppressed-warnings ((obsolete vc-switch-backend))
+ (vc-switch-backend file old-backend))
(let* ((rev (vc-working-revision file))
(modified-file (and edited (make-temp-file file)))
(unmodified-file (and modified-file (vc-version-backup-file file))))
@@ -2933,16 +2949,19 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
(vc-revert-file file))))
(vc-call-backend new-backend 'receive-file file rev))
(when modified-file
- (vc-switch-backend file new-backend)
+ (with-suppressed-warnings ((obsolete vc-switch-backend))
+ (vc-switch-backend file new-backend))
(unless (eq (vc-checkout-model new-backend (list file)) 'implicit)
(vc-checkout file))
(rename-file modified-file file 'ok-if-already-exists)
(vc-file-setprop file 'vc-checkout-time nil)))))
(when move
- (vc-switch-backend file old-backend)
+ (with-suppressed-warnings ((obsolete vc-switch-backend))
+ (vc-switch-backend file old-backend))
(setq comment (vc-call-backend old-backend 'comment-history file))
(vc-call-backend old-backend 'unregister file))
- (vc-switch-backend file new-backend)
+ (with-suppressed-warnings ((obsolete vc-switch-backend))
+ (vc-switch-backend file new-backend))
(when (or move edited)
(vc-file-setprop file 'vc-state 'edited)
(vc-mode-line file new-backend)
@@ -3064,20 +3083,6 @@ log entries should be gathered."
(vc-call-backend (vc-responsible-backend default-directory)
'update-changelog args))
-;; functions that operate on RCS revision numbers. This code should
-;; also be moved into the backends. It stays for now, however, since
-;; it is used in code below.
-(defun vc-branch-p (rev)
- "Return t if REV is a branch revision."
- (not (eq nil (string-match "\\`[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*\\'" rev))))
-
-;;;###autoload
-(defun vc-branch-part (rev)
- "Return the branch part of a revision number REV."
- (let ((index (string-match "\\.[0-9]+\\'" rev)))
- (when index
- (substring rev 0 index))))
-
(defun vc-default-responsible-p (_backend _file)
"Indicate whether BACKEND is responsible for FILE.
The default is to return nil always."