* Annoying call to error in goto-history-element
@ 2010-12-06 23:48 Geoff Gole
2010-12-06 23:59 ` Lennart Borgman
0 siblings, 1 reply; 4+ messages in thread
From: Geoff Gole @ 2010-12-06 23:48 UTC (permalink / raw)
To: Emacs development discussions
When moving through the history of find-file, running into the end of
the history will result in an error message briefly and annoyingly
obscuring the minibuffer. To see this, emacs -q C-x C-f <up>. The
cause is calls to error in goto-history-element.
It looks like in place of error we could call minibuffer-message and
exit the function (see patch below), which would make for a more
pleasant experience. Unfortunately that relies on the fact that the
callers of goto-history-element don't perform any real work after
their call to same, and that doesn't seem like a clean solution.
The only other thing I can think of is writing a macro
with-redirected-error-messages which would catch and redirect Lisp
errors into calls to minibuffer-message, and adding that to the
callers in question. I don't really like that either.
Thoughts?
--- - 2010-12-07 07:30:00.183679773 +0800
+++ simple.el 2010-12-07 07:26:02.000000000 +0800
@@ -1480,37 +1480,37 @@
(minibuffer-contents-no-properties)))
(if (< nabs minimum)
(if minibuffer-default
- (error "End of defaults; no next item")
- (error "End of history; no default available")))
- (if (> nabs (length (symbol-value minibuffer-history-variable)))
- (error "Beginning of history; no preceding item"))
- (unless (memq last-command '(next-history-element
- previous-history-element))
- (let ((prompt-end (minibuffer-prompt-end)))
- (set (make-local-variable 'minibuffer-temporary-goal-position)
- (cond ((<= (point) prompt-end) prompt-end)
- ((eobp) nil)
- (t (point))))))
- (goto-char (point-max))
- (delete-minibuffer-contents)
- (setq minibuffer-history-position nabs)
- (cond ((< nabs 0)
- (setq elt (if (listp minibuffer-default)
- (nth (1- (abs nabs)) minibuffer-default)
- minibuffer-default)))
- ((= nabs 0)
- (setq elt (or minibuffer-text-before-history ""))
- (setq minibuffer-returned-to-present t)
- (setq minibuffer-text-before-history nil))
- (t (setq elt (nth (1- minibuffer-history-position)
- (symbol-value minibuffer-history-variable)))))
- (insert
- (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
- (not minibuffer-returned-to-present))
- (let ((print-level nil))
- (prin1-to-string elt))
- elt))
- (goto-char (or minibuffer-temporary-goal-position (point-max)))))
+ (minibuffer-message "End of defaults; no next item")
+ (minibuffer-message "End of history; no default available"))
+ (if (> nabs (length (symbol-value minibuffer-history-variable)))
+ (minibuffer-message "Beginning of history; no preceding item")
+ (unless (memq last-command '(next-history-element
+ previous-history-element))
+ (let ((prompt-end (minibuffer-prompt-end)))
+ (set (make-local-variable 'minibuffer-temporary-goal-position)
+ (cond ((<= (point) prompt-end) prompt-end)
+ ((eobp) nil)
+ (t (point))))))
+ (goto-char (point-max))
+ (delete-minibuffer-contents)
+ (setq minibuffer-history-position nabs)
+ (cond ((< nabs 0)
+ (setq elt (if (listp minibuffer-default)
+ (nth (1- (abs nabs)) minibuffer-default)
+ minibuffer-default)))
+ ((= nabs 0)
+ (setq elt (or minibuffer-text-before-history ""))
+ (setq minibuffer-returned-to-present t)
+ (setq minibuffer-text-before-history nil))
+ (t (setq elt (nth (1- minibuffer-history-position)
+ (symbol-value minibuffer-history-variable)))))
+ (insert
+ (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
+ (not minibuffer-returned-to-present))
+ (let ((print-level nil))
+ (prin1-to-string elt))
+ elt))
+ (goto-char (or minibuffer-temporary-goal-position (point-max)))))))
(defun next-history-element (n)
"Puts next element of the minibuffer history in the minibuffer.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Annoying call to error in goto-history-element
2010-12-06 23:48 Annoying call to error in goto-history-element Geoff Gole
@ 2010-12-06 23:59 ` Lennart Borgman
2010-12-07 0:37 ` Geoff Gole
0 siblings, 1 reply; 4+ messages in thread
From: Lennart Borgman @ 2010-12-06 23:59 UTC (permalink / raw)
To: Geoff Gole; +Cc: Emacs development discussions
On Tue, Dec 7, 2010 at 12:48 AM, Geoff Gole <geoffgole@gmail.com> wrote:
> When moving through the history of find-file, running into the end of
> the history will result in an error message briefly and annoyingly
> obscuring the minibuffer. To see this, emacs -q C-x C-f <up>. The
> cause is calls to error in goto-history-element.
>
> It looks like in place of error we could call minibuffer-message and
> exit the function (see patch below), which would make for a more
> pleasant experience. Unfortunately that relies on the fact that the
> callers of goto-history-element don't perform any real work after
> their call to same, and that doesn't seem like a clean solution.
>
> The only other thing I can think of is writing a macro
> with-redirected-error-messages which would catch and redirect Lisp
> errors into calls to minibuffer-message, and adding that to the
> callers in question. I don't really like that either.
>
> Thoughts?
Is it necessary with a message at all here? Just some kind of visible
"beep" instead perhaps?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-07 1:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-06 23:48 Annoying call to error in goto-history-element Geoff Gole
2010-12-06 23:59 ` Lennart Borgman
2010-12-07 0:37 ` Geoff Gole
2010-12-07 1:07 ` Lennart Borgman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.