From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] Open single link immediately Date: Fri, 28 Aug 2009 13:23:00 -0400 Message-ID: <1251480180-9815-1-git-send-email-bernt@norang.ca> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mh5AO-0003wI-Vo for emacs-orgmode@gnu.org; Fri, 28 Aug 2009 13:23:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mh5AL-0003tO-H0 for emacs-orgmode@gnu.org; Fri, 28 Aug 2009 13:23:12 -0400 Received: from [199.232.76.173] (port=58029 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh5AL-0003sv-1o for emacs-orgmode@gnu.org; Fri, 28 Aug 2009 13:23:09 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:53578) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mh5AK-0000tU-Li for emacs-orgmode@gnu.org; Fri, 28 Aug 2009 13:23:08 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1Mh5AJ-0001Iz-Q2 for emacs-orgmode@gnu.org; Fri, 28 Aug 2009 17:23:07 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Bernt Hansen C-c C-o on a headline or in the agenda displays a menu of links to choose from. If there is only a single link then go there directly skipping the menu. --- This patch is available at git://git.norang.ca/org-mode.git for-carsten lisp/org.el | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index a5181ab..f3d8976 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8073,21 +8073,22 @@ needed for the interpretation of abbreviated links." (push (match-string 0) links)) (setq links (reverse links)) (unless links (error "No links")) - - (unless (and (integerp nth) (>= (length links) nth)) - (save-excursion - (save-window-excursion - (delete-other-windows) - (with-output-to-temp-buffer "*Select Link*" - (princ "Select link\n\n") - (mapc (lambda (l) (princ (format "[%d] %s\n" (incf cnt) l))) - links)) - (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) - (message "Select link to open:") - (setq c (read-char-exclusive)) - (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) - (setq nth (- c ?0))) - + (if (eq 1 (length links)) + (setq c 1) + (unless (and (integerp nth) (>= (length links) nth)) + (save-excursion + (save-window-excursion + (delete-other-windows) + (with-output-to-temp-buffer "*Select Link*" + (princ "Select link\n\n") + (mapc (lambda (l) (princ (format "[%d] %s\n" (incf cnt) l))) + links)) + (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) + (message "Select link to open:") + (setq c (read-char-exclusive)) + (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))))) + (setq nth (- c ?0)) + (unless (and (integerp nth) (>= (length links) nth)) (error "Invalid link selection")) (setq link (nth (1- nth) links) -- 1.6.4.1.331.gda1d56