summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2000-03-21 16:53:06 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2000-03-21 16:53:06 +0000
commit36a5b60e8e86c5225fe230a288c001f351e3825f (patch)
treee61a4ede6919933c40040d0745ec88125207fa0f /lisp/emacs-lisp
parentd2cafc8c0ab73480c69068fbfe5b3f69ab05ef17 (diff)
downloademacs-36a5b60e8e86c5225fe230a288c001f351e3825f.tar.gz
emacs-36a5b60e8e86c5225fe230a288c001f351e3825f.tar.bz2
emacs-36a5b60e8e86c5225fe230a288c001f351e3825f.zip
(easy-mmode-define-navigation): Only use `ding' for interactive use
else, use `error' (to enable the caller to react to the problem).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index edc0319c417..88e6da28f84 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -363,14 +363,16 @@ ENDFUN should return the end position (with or without moving point)."
(let* ((base-name (symbol-name base))
(prev-sym (intern (concat base-name "-prev")))
(next-sym (intern (concat base-name "-next"))))
+ (unless name (setq name (symbol-name base-name)))
`(progn
(defun ,next-sym (&optional count)
- ,(format "Go to the next COUNT'th %s." (or name base-name))
+ ,(format "Go to the next COUNT'th %s." name)
(interactive)
(unless count (setq count 1))
(if (< count 0) (,prev-sym (- count))
(if (looking-at ,re) (incf count))
- (or (re-search-forward ,re nil t count) (ding))
+ (unless (re-search-forward ,re nil t count)
+ (if (interactive-p) (ding) (error ,(format "No next %s" name))))
(goto-char (match-beginning 0))
(when (eq (current-buffer) (window-buffer (selected-window)))
(let ((endpt (or (save-excursion
@@ -383,7 +385,9 @@ ENDFUN should return the end position (with or without moving point)."
(interactive)
(unless count (setq count 1))
(if (< count 0) (,next-sym (- count))
- (or (re-search-backward ,re nil t count) (ding)))))))
+ (unless (re-search-backward ,re nil t count)
+ (if (interactive-p) (ding)
+ (error ,(format "No previous %s" name)))))))))
(provide 'easy-mmode)