emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Yuri Lenskiy <lenskiy@mit.edu>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Addition of default-description parameter to org-insert-link
Date: Wed, 26 Oct 2011 12:47:46 -0400	[thread overview]
Message-ID: <CABAjAKc0XK4ZJX6Cw=PhWAq24EmYNwSzbDVu378XUa4JMbEr_g@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 187 bytes --]

This patch, against the stable 7.7 branch version of org.el, adds a
default-description argument to org-insert-link that, if non-nil, will
become the default description.

- Yuri Lenskiy

[-- Attachment #1.2: Type: text/html, Size: 197 bytes --]

[-- Attachment #2: org.el.diff --]
[-- Type: text/plain, Size: 1506 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index c29ef11..bf6daab 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8854,7 +8854,7 @@ This command can be called in any mode to insert a link in Org-mode syntax."
   (org-load-modules-maybe)
   (org-run-like-in-org-mode 'org-insert-link))
 
-(defun org-insert-link (&optional complete-file link-location)
+(defun org-insert-link (&optional complete-file link-location default-description)
   "Insert a link.  At the prompt, enter the link.
 
 Completion can be used to insert any of the link protocol prefixes like
@@ -8890,7 +8890,10 @@ called with the link target, and the result will be the default
 link description.
 
 If the LINK-LOCATION parameter is non-nil, this value will be
-used as the link location instead of reading one interactively."
+used as the link location instead of reading one interactively.
+
+If the DEFAULT-DESCRIPTION parameter is non-nil, this value will
+be used as the default description."
   (interactive "P")
   (let* ((wcf (current-window-configuration))
 	 (region (if (org-region-active-p)
@@ -9020,6 +9023,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
     (if org-make-link-description-function
 	(setq desc (funcall org-make-link-description-function link desc)))
 
+    (if default-description (setq desc default-description))
     (setq desc (read-string "Description: " desc))
     (unless (string-match "\\S-" desc) (setq desc nil))
     (if remove (apply 'delete-region remove))

             reply	other threads:[~2011-10-26 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 16:47 Yuri Lenskiy [this message]
2011-10-26 17:04 ` [Accepted] Addition of default-description parameter to org-insert-link Bastien Guerry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABAjAKc0XK4ZJX6Cw=PhWAq24EmYNwSzbDVu378XUa4JMbEr_g@mail.gmail.com' \
    --to=lenskiy@mit.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).