[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Word under cursor to internal link
From: |
John Kitchin |
Subject: |
Re: [O] Word under cursor to internal link |
Date: |
Thu, 18 Dec 2014 20:08:14 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin) |
Something like this seems to do approximately what you want:
#+BEGIN_SRC emacs-lisp
(defun word-to-link ()
(interactive)
(save-excursion
(let (start end word)
(backward-word)
(setq start (point))
(forward-word)
(setq end (point))
(setq word (buffer-substring start end))
(setf (buffer-substring start end)
(format "[[%s]]" word)))))
#+END_SRC
Chaitanya Krishna <address@hidden> writes:
> Hello there,
>
> Is there a shortcut to change word under cursor to an internal link?
> Basically it is a pain trying to surround with two braces all the
> time!
>
> C-c C-l does not prompt me to create an internal link.
>
> Best regards,
> Chai
>
--
-----------------------------------
John Kitchin
Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu