From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Word under cursor to internal link Date: Thu, 18 Dec 2014 20:08:14 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1m3L-0002fX-Co for emacs-orgmode@gnu.org; Thu, 18 Dec 2014 20:08:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1m3F-0005ws-NB for emacs-orgmode@gnu.org; Thu, 18 Dec 2014 20:08:23 -0500 Received: from mail-qc0-x22d.google.com ([2607:f8b0:400d:c01::22d]:38157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1m3F-0005wn-Iv for emacs-orgmode@gnu.org; Thu, 18 Dec 2014 20:08:17 -0500 Received: by mail-qc0-f173.google.com with SMTP id i17so45577qcy.4 for ; Thu, 18 Dec 2014 17:08:16 -0800 (PST) In-Reply-To: (Chaitanya Krishna's message of "Fri, 19 Dec 2014 01:31:34 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Chaitanya Krishna Cc: emacs-orgmode@gnu.org 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 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