aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-03-21 16:53:06 +0000
committerStefan Monnier2000-03-21 16:53:06 +0000
commit36a5b60e8e86c5225fe230a288c001f351e3825f (patch)
treee61a4ede6919933c40040d0745ec88125207fa0f
parentd2cafc8c0ab73480c69068fbfe5b3f69ab05ef17 (diff)
downloademacs-36a5b60e8e86c5225fe230a288c001f351e3825f.tar.gz
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).
-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)."
363 (let* ((base-name (symbol-name base)) 363 (let* ((base-name (symbol-name base))
364 (prev-sym (intern (concat base-name "-prev"))) 364 (prev-sym (intern (concat base-name "-prev")))
365 (next-sym (intern (concat base-name "-next")))) 365 (next-sym (intern (concat base-name "-next"))))
366 (unless name (setq name (symbol-name base-name)))
366 `(progn 367 `(progn
367 (defun ,next-sym (&optional count) 368 (defun ,next-sym (&optional count)
368 ,(format "Go to the next COUNT'th %s." (or name base-name)) 369 ,(format "Go to the next COUNT'th %s." name)
369 (interactive) 370 (interactive)
370 (unless count (setq count 1)) 371 (unless count (setq count 1))
371 (if (< count 0) (,prev-sym (- count)) 372 (if (< count 0) (,prev-sym (- count))
372 (if (looking-at ,re) (incf count)) 373 (if (looking-at ,re) (incf count))
373 (or (re-search-forward ,re nil t count) (ding)) 374 (unless (re-search-forward ,re nil t count)
375 (if (interactive-p) (ding) (error ,(format "No next %s" name))))
374 (goto-char (match-beginning 0)) 376 (goto-char (match-beginning 0))
375 (when (eq (current-buffer) (window-buffer (selected-window))) 377 (when (eq (current-buffer) (window-buffer (selected-window)))
376 (let ((endpt (or (save-excursion 378 (let ((endpt (or (save-excursion
@@ -383,7 +385,9 @@ ENDFUN should return the end position (with or without moving point)."
383 (interactive) 385 (interactive)
384 (unless count (setq count 1)) 386 (unless count (setq count 1))
385 (if (< count 0) (,next-sym (- count)) 387 (if (< count 0) (,next-sym (- count))
386 (or (re-search-backward ,re nil t count) (ding))))))) 388 (unless (re-search-backward ,re nil t count)
389 (if (interactive-p) (ding)
390 (error ,(format "No previous %s" name)))))))))
387 391
388(provide 'easy-mmode) 392(provide 'easy-mmode)
389 393