[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] [PATCH] Open single link immediately
From: |
Bernt Hansen |
Subject: |
[Orgmode] [PATCH] Open single link immediately |
Date: |
Fri, 28 Aug 2009 13:23:00 -0400 |
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
- [Orgmode] [PATCH] Open single link immediately,
Bernt Hansen <=