emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Making Abbreviated links
@ 2007-05-18 19:18 Bastien
  2007-05-21  7:08 ` Carsten Dominik
  2007-05-22  4:37 ` Xavier Maillard
  0 siblings, 2 replies; 3+ messages in thread
From: Bastien @ 2007-05-18 19:18 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

this function allows you to turn the region into a abbreviated link, the
minibuffer being aware of the local #+LINK: options.  With a prefix, ask
for the link itself as well.

Comments & suggestions welcome !

========================================================================
(defun bzg-org-link-this-region (&optional full)
  "Turn the region into a abbreviated link.
With a prefix, ask the for link as well."
  (interactive "P")
  (when (org-region-active-p)
    (let* ((beg (region-beginning))
	   (end (region-end))
	   (history (mapcar 'car org-link-abbrev-alist-local))
	   (desc (buffer-substring-no-properties beg end))
           (link (if full (concat (completing-read "#+LINK: " history)
				  ":" (read-from-minibuffer "Link: "))
		   (concat (completing-read "#+LINK: " history) ":" desc))))
      (kill-region beg end)
      (insert (org-make-link-string link desc)))))
========================================================================

-- 
Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Making Abbreviated links
  2007-05-18 19:18 Making Abbreviated links Bastien
@ 2007-05-21  7:08 ` Carsten Dominik
  2007-05-22  4:37 ` Xavier Maillard
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2007-05-21  7:08 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

This is a great idea.  If you agree, I will incorporate
this into the C-c C-l command.  Stored links will still be
accessible through <up> and <down>, while completion
will complete link prefixes like http, and also link
abbreviation prefixes.

- Carsten

On May 18, 2007, at 21:18, Bastien wrote:

> Hello,
>
> this function allows you to turn the region into a abbreviated link,  
> the
> minibuffer being aware of the local #+LINK: options.  With a prefix,  
> ask
> for the link itself as well.
>
> Comments & suggestions welcome !
>
> ======================================================================= 
> =
> (defun bzg-org-link-this-region (&optional full)
>   "Turn the region into a abbreviated link.
> With a prefix, ask the for link as well."
>   (interactive "P")
>   (when (org-region-active-p)
>     (let* ((beg (region-beginning))
> 	   (end (region-end))
> 	   (history (mapcar 'car org-link-abbrev-alist-local))
> 	   (desc (buffer-substring-no-properties beg end))
>            (link (if full (concat (completing-read "#+LINK: " history)
> 				  ":" (read-from-minibuffer "Link: "))
> 		   (concat (completing-read "#+LINK: " history) ":" desc))))
>       (kill-region beg end)
>       (insert (org-make-link-string link desc)))))
> ======================================================================= 
> =
>
> -- 
> Bastien
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Making Abbreviated links
  2007-05-18 19:18 Making Abbreviated links Bastien
  2007-05-21  7:08 ` Carsten Dominik
@ 2007-05-22  4:37 ` Xavier Maillard
  1 sibling, 0 replies; 3+ messages in thread
From: Xavier Maillard @ 2007-05-22  4:37 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


   Comments & suggestions welcome !

Please install this !

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-22  4:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-18 19:18 Making Abbreviated links Bastien
2007-05-21  7:08 ` Carsten Dominik
2007-05-22  4:37 ` Xavier Maillard

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).