From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Geoff Gole Newsgroups: gmane.emacs.devel Subject: Annoying call to error in goto-history-element Date: Tue, 7 Dec 2010 07:48:28 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1291679324 23924 80.91.229.12 (6 Dec 2010 23:48:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Dec 2010 23:48:44 +0000 (UTC) To: Emacs development discussions Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 07 00:48:40 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PPknP-0006xn-Og for ged-emacs-devel@m.gmane.org; Tue, 07 Dec 2010 00:48:40 +0100 Original-Received: from localhost ([127.0.0.1]:50628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPknP-0002Es-6u for ged-emacs-devel@m.gmane.org; Mon, 06 Dec 2010 18:48:39 -0500 Original-Received: from [140.186.70.92] (port=46172 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPknI-00026m-TV for emacs-devel@gnu.org; Mon, 06 Dec 2010 18:48:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPknH-0008I2-MW for emacs-devel@gnu.org; Mon, 06 Dec 2010 18:48:32 -0500 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:52478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPknH-0008Ha-IP for emacs-devel@gnu.org; Mon, 06 Dec 2010 18:48:31 -0500 Original-Received: by wyj26 with SMTP id 26so5521349wyj.0 for ; Mon, 06 Dec 2010 15:48:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=EXR39JgM2woRJ3UDJv8p2pXQGok2IGo2TZvdRRinUCg=; b=W83E2llXkeV4CvjfG+51u0how1RPirYZA3PgZQq9br0cL4ztFbA7+BL4ZmlqeZoMRU UK87LhEji+Hb1z3D84SaQTEAuccT7kn9pV8cL+vDwohU61s7Jbg/l9ndv3eAMoNeh/ve uWBg01DuhZJWBLQhBbPlUi5sBsqSll9kGq4pA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=kPs2xYnvm3+oTx8s6/hysuy1GW/G/yRrwWEWesUqM8xfYYQQOGXdkpmWJ1edBIHawd wwYkOO9IX68WQoyQD+gRhF8OTMY5w9efP9xixHKk03oJ/qS220eEn3XNECb/6H6czJXX ddCvQIT4LMkTKMAoKeFkWxg3zgT3T9XocRkFY= Original-Received: by 10.216.166.201 with SMTP id g51mr1747330wel.21.1291679308555; Mon, 06 Dec 2010 15:48:28 -0800 (PST) Original-Received: by 10.216.53.145 with HTTP; Mon, 6 Dec 2010 15:48:28 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133477 Archived-At: 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 . 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.