(ediff-skip-unsuitable-frames)
(switch-to-buffer error-buf)
(ediff-kill-buffer-carefully ctl-buf)
- (error "Errors in diff output. Diff output is in %S" diff-buff))))
+ (user-error "Errors in diff output. Diff output is in %S" diff-buff))))
;; BOUNDS specifies visibility bounds to use.
;; WORD-MODE tells whether we are in the word-mode or not.
(overlays-at pos)))))
(if (not (stringp cmd))
- (error "Hmm... I don't see an Ediff command around here..."))
+ (user-error "Hmm... I don't see an Ediff command around here..."))
(ediff-documentation "Quick Help Commands")
((string= cmd "s") (re-search-forward "^['`‘]s['’]"))
((string= cmd "+") (re-search-forward "^['`‘]\\+['’]"))
((string= cmd "=") (re-search-forward "^['`‘]=['’]"))
- (t (error "Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer")))
+ (t (user-error "Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer")))
) ; let case-fold-search
))
(defsubst ediff-barf-if-not-control-buffer (&optional meta-buf-p)
(or (ediff-in-control-buffer-p meta-buf-p)
- (error "%S: This command runs in Ediff Control Buffer only!"
- this-command)))
+ (user-error "%S: This command runs in Ediff Control Buffer only!"
+ this-command)))
(defgroup ediff-highlighting nil
"Highlighting of difference regions in Ediff."
(funcall op emacs-minor-version minor)
t)))
(t
- (error "%S: Invalid op in ediff-check-version" op)))))
+ (user-error "%S: Invalid op in ediff-check-version" op)))))
(defun ediff-color-display-p ()
(condition-case nil
Used only for merging jobs."
(interactive "P")
(if (not ediff-merge-job)
- (error "ediff-shrink-window-C can be used only for merging jobs"))
+ (user-error "ediff-shrink-window-C can be used only for merging jobs"))
(cond ((eq arg '-) (setq arg -1))
((not (numberp arg)) (setq arg nil)))
(cond ((null arg)
(insert "\n")))
(defun ediff-draw-dir-diffs (diff-list &optional buf-name)
- (if (null diff-list) (error "Lost difference info on these directories"))
+ (if (null diff-list) (user-error "Lost difference info on these directories"))
(setq buf-name
(or buf-name
(ediff-unique-buffer-name "*Ediff File Group Differences" "*")))
"Display differences among the directories involved in session group."
(interactive)
(if (ediff-one-filegroup-metajob)
- (error "This command is inapplicable in the present context"))
+ (user-error "This command is inapplicable in the present context"))
(or (ediff-buffer-live-p ediff-dir-diffs-buffer)
(ediff-draw-dir-diffs ediff-dir-difference-list))
(let ((buf ediff-dir-diffs-buffer))
(if (ediff-buffer-live-p ediff-parent-meta-buffer)
(ediff-show-meta-buffer
ediff-parent-meta-buffer ediff-meta-session-number)
- (error "This session group has no parent")))
+ (user-error "This session group has no parent")))
;; argument is ignored
(cond (ignore)
(unmark (ediff-set-session-status info nil))
;;; (if (ediff-buffer-live-p session-buf)
-;;; (error "Can't hide active session, %s" (buffer-name session-buf)))
+;;; (user-error "Can't hide active session, %s" (buffer-name session-buf)))
(t (ediff-set-session-status info ?H))))
unmark)
(setq custom-diff-buf ediff-custom-diff-buffer)))))
(or (ediff-buffer-live-p meta-diff-buff)
- (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
(insert "\n")))
(t
(ediff-kill-buffer-carefully meta-diff-buff)
- (error "Session %d compares versions of file. Such session must be active to enable multifile patch collection" sessionNum )))
+ (user-error "Session %d compares versions of file. Such session must be active to enable multifile patch collection" sessionNum )))
))
(defun ediff-collect-custom-diffs ()
(goto-char (point-min))
(display-buffer ediff-tmp-buffer 'not-this-window)
))
- (error "The patch buffer wasn't found"))))
+ (user-error "The patch buffer wasn't found"))))
(declare-function ediff-directories-internal "ediff"
(dir1 dir2 dir3 regexp action jobname
(progn
(ediff-set-session-status info nil)
(ediff-update-meta-buffer meta-buf nil session-number))
- (error "Aborted"))))
+ (user-error "Aborted"))))
(ediff-with-current-buffer meta-buf
(setq merge-autostore-dir
;; level; see below
(setcar
(quote ,info) ediff-control-buffer))))
- (error "Aborted")))
+ (user-error "Aborted")))
((ediff-one-filegroup-metajob) ; needs 1 file arg
(funcall ediff-session-action-function
file1
(setq meta-buf (or meta-buf ediff-meta-buffer))
(cond ((not (bufferp meta-buf))
- (error "This Ediff session is not part of a session group"))
+ (user-error "This Ediff session is not part of a session group"))
((not (ediff-buffer-live-p meta-buf))
(error
"Can't find this session's group panel -- session itself is ok")))
(interactive)
(ediff-update-registry)
(if (not (ediff-buffer-live-p ediff-registry-buffer))
- (error "No active Ediff sessions or corrupted session registry"))
+ (user-error "No active Ediff sessions or corrupted session registry"))
(let (wind frame)
;; for some reason, point moves in ediff-registry-buffer, so we preserve it
;; explicitly
(or result
(unless noerror
(ediff-update-registry)
- (error "No session info in this line")))))
+ (user-error "No session info in this line")))))
(defun ediff-get-meta-overlay-at-pos (point)
session-buf beg-marker end-marker)
(if (or (file-directory-p file) (string-match "/dev/null" file))
- (error "`%s' is not an ordinary file" (file-name-as-directory file)))
+ (user-error "`%s' is not an ordinary file" (file-name-as-directory file)))
(setq session-buf (ediff-get-session-buffer info)
beg-marker (ediff-get-session-objB-name info)
end-marker (ediff-get-session-objC-name info))
(select-window aux-wind)
(goto-char (point-max))))
(switch-to-buffer-other-window patch-diagnostics)
- (error "Patch appears to have failed")))
+ (user-error "Patch appears to have failed")))
;; If black magic is involved, apply patch to a temp copy of the
;; file. Otherwise, apply patch to the orig copy. If patch is applied
(interactive)
(ediff-barf-if-not-control-buffer)
(if ediff-word-mode
- (error "No fine differences in this mode"))
+ (user-error "No fine differences in this mode"))
(cond ((eq ediff-auto-refine 'nix)
(setq ediff-auto-refine 'on)
(ediff-make-fine-diffs ediff-current-difference 'noforce)
(defun ediff--check-ancestor-exists ()
(or (ediff-buffer-live-p ediff-ancestor-buffer)
(if ediff-merge-with-ancestor-job
- (error "Lost connection to ancestor buffer. This shouldn't happen. \
+ (user-error "Lost connection to ancestor buffer. This shouldn't happen. \
Please report this bug to bug-gnu-emacs@gnu.org")
- (error "Not merging with ancestor"))))
+ (user-error "Not merging with ancestor"))))
;; Restore `ediff-show-ancestor' on exit.
(defun ediff--restore-options-on-exit ()
(save-window-excursion
(select-window (ediff-get-visible-buffer-window buf))
(command-execute toggle-ro-cmd)))
- (error "Don't know how to toggle read-only in buffer %S" buf))
+ (user-error "Don't know how to toggle read-only in buffer %S" buf))
;; Check if we made the current buffer updatable, but its file is RO.
;; Signal a warning in this case.
(interactive)
(ediff-barf-if-not-control-buffer)
(or (ediff-window-display-p)
- (error "%sEmacs is not running as a window application"
+ (user-error "%sEmacs is not running as a window application"
(if (featurep 'emacs) "" "X")))
(ediff-recenter 'no-rehighlight) ; make sure buffs are displayed in windows
(let ((ctl-buf ediff-control-buffer))
(interactive)
(let (window-setup-func)
(or (ediff-window-display-p)
- (error "%sEmacs is not running as a window application"
+ (user-error "%sEmacs is not running as a window application"
(if (featurep 'emacs) "" "X")))
(cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe)
(if (featurep 'ediff-tbar)
(progn
(or (ediff-window-display-p)
- (error "%sEmacs is not running as a window application"
+ (user-error "%sEmacs is not running as a window application"
(if (featurep 'emacs) "" "X")))
(if (ediff-use-toolbar-p)
(ediff-kill-bottom-toolbar))
(interactive)
(ediff-barf-if-not-control-buffer)
(if (not ediff-merge-with-ancestor-job)
- (error "This command makes sense only when merging with an ancestor"))
+ (user-error "This command makes sense only when merging with an ancestor"))
(setq ediff-show-clashes-only (not ediff-show-clashes-only))
(if ediff-show-clashes-only
(message "Focus on regions where both buffers differ from the ancestor")
(ediff-unselect-and-select-difference n)
) ; let
(ediff-visible-region)
- (error "At end of the difference list")))
+ (user-error "At end of the difference list")))
(defun ediff-previous-difference (&optional arg)
"Go to the previous difference.
(ediff-unselect-and-select-difference n)
) ; let
(ediff-visible-region)
- (error "At beginning of the difference list")))
+ (user-error "At beginning of the difference list")))
;; The diff number is as perceived by the user (i.e., 1+ the internal
;; representation)
(if (cdr saved-rec)
(setq saved-diff (cdr saved-rec))
(if (> ediff-number-of-differences 0)
- (error "Nothing saved for diff %d in buffer %S" (1+ n) buf-type)
+ (user-error "Nothing saved for diff %d in buffer %S" (1+ n) buf-type)
(error ediff-NO-DIFFERENCES)))
(setq reg-beg (ediff-get-diff-posn buf-type 'beg n ediff-control-buffer))
(setq f (expand-file-name
(file-name-nondirectory default-file) f)))
(if (and no-dirs (file-directory-p f))
- (error "File %s is a directory" f))
+ (user-error "File %s is a directory" f))
f))
;; If PREFIX is given, then it is used as a prefix for the temp file
(error
(beep)
(message "Couldn't save %s" buffer-file-name)))
- (error "Buffer is out of sync for file %s" buffer-file-name))
+ (user-error "Buffer is out of sync for file %s" buffer-file-name))
;; If buffer is not obsolete and is not modified, do nothing
nil)
;; If buffer is obsolete, offer to revert
(if file-magic
(erase-buffer))
(revert-buffer t t))
- (error "Buffer out of sync for file %s" buffer-file-name))))
+ (user-error "Buffer out of sync for file %s" buffer-file-name))))
;; if there is another buffer visiting the file of the merge buffer, offer to
;; save and delete the buffer; else bark
ediff-custom-diff-buffer)
((ediff-buffer-live-p ediff-diff-buffer)
ediff-diff-buffer)
- (t (error "Output from `diff' not found"))))
+ (t (user-error "Output from `diff' not found"))))
)
(let ((window-min-height 2))
(save-buffer))))
This function modifies only the left margin and the width of the display.
It assumes that it is called from within the control buffer."
(if (not (fboundp 'ediff-display-pixel-width))
- (error "Can't determine display width"))
+ (user-error "Can't determine display width"))
(let* ((frame-A (window-frame ediff-window-A))
(frame-A-params (frame-parameters frame-A))
(cw (ediff-frame-char-width frame-A))
(file-magic (ediff-filename-magic-p file))
(temp-file-name-prefix (file-name-nondirectory file)))
(cond ((not (file-readable-p file))
- (error "File `%s' does not exist or is not readable" file))
+ (user-error "File `%s' does not exist or is not readable" file))
((file-directory-p file)
- (error "File `%s' is a directory" file)))
+ (user-error "File `%s' is a directory" file)))
;; some of the commands, below, require full file name
(setq file (expand-file-name file))
(unwind-protect
(progn
(if (not (ediff-buffer-live-p buf-A))
- (error "Buffer %S doesn't exist" buf-A))
+ (user-error "Buffer %S doesn't exist" buf-A))
(if (not (ediff-buffer-live-p buf-B))
- (error "Buffer %S doesn't exist" buf-B))
+ (user-error "Buffer %S doesn't exist" buf-B))
(let ((ediff-job-name job-name))
(if (and ediff-3way-comparison-job
(not buf-C-is-alive))
- (error "Buffer %S doesn't exist" buf-C)))
+ (user-error "Buffer %S doesn't exist" buf-C)))
(if (stringp buf-A-file-name)
(setq buf-A-file-name (file-name-nondirectory buf-A-file-name)))
(if (stringp buf-B-file-name)
(setq dir3 (if (file-directory-p dir3) dir3 (file-name-directory dir3))))
(cond ((string= dir1 dir2)
- (error "Directories A and B are the same: %s" dir1))
+ (user-error "Directories A and B are the same: %s" dir1))
((and (eq jobname 'ediff-directories3)
(string= dir1 dir3))
- (error "Directories A and C are the same: %s" dir1))
+ (user-error "Directories A and C are the same: %s" dir1))
((and (eq jobname 'ediff-directories3)
(string= dir2 dir3))
- (error "Directories B and C are the same: %s" dir1)))
+ (user-error "Directories B and C are the same: %s" dir1)))
(if merge-autostore-dir
(or (stringp merge-autostore-dir)
(cond ((and (stringp dir1) (string= merge-autostore-dir dir1))
(or (y-or-n-p
"Directory for saving merged files = Directory A. Sure? ")
- (error "Directory merge aborted")))
+ (user-error "Directory merge aborted")))
((and (stringp dir2) (string= merge-autostore-dir dir2))
(or (y-or-n-p
"Directory for saving merged files = Directory B. Sure? ")
- (error "Directory merge aborted")))
+ (user-error "Directory merge aborted")))
((and (stringp dir3) (string= merge-autostore-dir dir3))
(or (y-or-n-p
"Directory for saving merged files = Ancestor Directory. Sure? ")
- (error "Directory merge aborted")))))
+ (user-error "Directory merge aborted")))))
(setq dir-diff-struct (ediff-intersect-directories
jobname
(string= merge-autostore-dir dir1))
(or (y-or-n-p
"Directory for saving merged file = directory A. Sure? ")
- (error "Merge of directory revisions aborted")))
+ (user-error "Merge of directory revisions aborted")))
(setq file-list
(ediff-get-directory-files-under-revision
(ediff-other-buffer bf))
t))))
(if (not (ediff-buffer-live-p buffer-A))
- (error "Buffer %S doesn't exist" buffer-A))
+ (user-error "Buffer %S doesn't exist" buffer-A))
(if (not (ediff-buffer-live-p buffer-B))
- (error "Buffer %S doesn't exist" buffer-B))
+ (user-error "Buffer %S doesn't exist" buffer-B))
(let ((buffer-A
(ediff-other-buffer bf))
t))))
(if (not (ediff-buffer-live-p buffer-A))
- (error "Buffer %S doesn't exist" buffer-A))
+ (user-error "Buffer %S doesn't exist" buffer-A))
(if (not (ediff-buffer-live-p buffer-B))
- (error "Buffer %S doesn't exist" buffer-B))
+ (user-error "Buffer %S doesn't exist" buffer-B))
(let ((buffer-A
(ediff-clone-buffer-for-region-comparison buffer-A "-Region.A-"))
(message "") ; kill the message from `locate-library'
(require ediff-version-control-package))
(or silent
- (error "Version control package %S.el not found. Use vc.el instead"
+ (user-error "Version control package %S.el not found. Use vc.el instead"
ediff-version-control-package)))))
(select-window ctl-window)
(set-window-buffer ctl-window ctl-buf)))))))
-
-(dolist (mess '("^Errors in diff output. Diff output is in "
- "^Hmm... I don't see an Ediff command around here...$"
- "^Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer$"
- ": This command runs in Ediff Control Buffer only!$"
- ": Invalid op in ediff-check-version$"
- "^ediff-shrink-window-C can be used only for merging jobs$"
- "^Lost difference info on these directories$"
- "^This command is inapplicable in the present context$"
- "^This session group has no parent$"
- "^Can't hide active session, $"
- "^Ediff: something wrong--no multiple diffs buffer$"
- "^Can't make context diff for Session $"
- "^The patch buffer wasn't found$"
- "^Aborted$"
- "^This Ediff session is not part of a session group$"
- "^No active Ediff sessions or corrupted session registry$"
- "^No session info in this line$"
- "^`.*' is not an ordinary file$"
- "^Patch appears to have failed$"
- "^Recomputation of differences cancelled$"
- "^No fine differences in this mode$"
- "^Lost connection to ancestor buffer...sorry$"
- "^Not merging with ancestor$"
- "^Don't know how to toggle read-only in buffer "
- "Emacs is not running as a window application$"
- "^This command makes sense only when merging with an ancestor$"
- "^At end of the difference list$"
- "^At beginning of the difference list$"
- "^Nothing saved for diff .* in buffer "
- "^Buffer is out of sync for file "
- "^Buffer out of sync for file "
- "^Output from `diff' not found$"
- "^You forgot to specify a region in buffer "
- "^All right. Make up your mind and come back...$"
- "^Current buffer is not visiting any file$"
- "^Failed to retrieve revision: $"
- "^Can't determine display width.$"
- "^File `.*' does not exist or is not readable$"
- "^File `.*' is a directory$"
- "^Buffer .* doesn't exist$"
- "^Directories . and . are the same: "
- "^Directory merge aborted$"
- "^Merge of directory revisions aborted$"
- "^Buffer .* doesn't exist$"
- "^There is no file to merge$"
- "^Version control package .*.el not found. Use vc.el instead$"))
- (add-to-list 'debug-ignored-errors mess))
-
-
\f
;;; Command line interface