# HG changeset patch # User Stefan Monnier # Date 953657586 0 # Node ID 21cd65af519747864b1ac9a693c1125ef9e5a3f5 # Parent d2822c1e22afc2d0f25d9710e6e39bed12282746 (easy-mmode-define-navigation): Only use `ding' for interactive use else, use `error' (to enable the caller to react to the problem). diff -r d2822c1e22af -r 21cd65af5197 lisp/emacs-lisp/easy-mmode.el --- a/lisp/emacs-lisp/easy-mmode.el Tue Mar 21 16:13:31 2000 +0000 +++ b/lisp/emacs-lisp/easy-mmode.el Tue Mar 21 16:53:06 2000 +0000 @@ -363,14 +363,16 @@ (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 @@ (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)