From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leu Zhe Subject: Word under cursor to internal link Date: Fri, 19 Dec 2014 10:45:09 +0900 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b3a94d645bf2f050a87deb0 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1mdb-0001JT-C5 for emacs-orgmode@gnu.org; Thu, 18 Dec 2014 20:45:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1mda-0004ZZ-Hi for emacs-orgmode@gnu.org; Thu, 18 Dec 2014 20:45:51 -0500 Received: from mail-ob0-x229.google.com ([2607:f8b0:4003:c01::229]:32848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1mda-0004Z9-Ax for emacs-orgmode@gnu.org; Thu, 18 Dec 2014 20:45:50 -0500 Received: by mail-ob0-f169.google.com with SMTP id vb8so9401831obc.0 for ; Thu, 18 Dec 2014 17:45:49 -0800 (PST) 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: icymist@gmail.com, "emacs-orgmode@gnu.org" --047d7b3a94d645bf2f050a87deb0 Content-Type: text/plain; charset=ISO-8859-1 You can use the function below to make it. But in order to replace it rightly, you need to put you cursor inside the word or at the beginning of the word. (defun word-to-link () (interactive) (let ((word (thing-at-point 'word))) (forward-word) (kill-word -1) (insert (format "[[%s]]" word)))) Hope it helps. And any improvement will be welcome. --047d7b3a94d645bf2f050a87deb0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You can use the function below to make it.
But in orde= r to replace it rightly, you need to put you cursor inside the word or at t= he beginning of the word.

(defun word-to-link= ()
=A0 (interactive)
=A0 (let ((word (thing-at-point &= #39;word)))
=A0 =A0 (forward-word)
=A0 =A0 (kill-word -= 1)
=A0 =A0 (insert (format "[[%s]]" word))))

Hope it helps. And any improvement will be welcome.
--047d7b3a94d645bf2f050a87deb0--