[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Toggle WikiLink on and off does not work?

From: Csányi Pál
Subject: Toggle WikiLink on and off does not work?
Date: Wed, 16 Aug 2017 10:55:31 +0200


I'm running GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.16)
 of 2017-08-14 on my Gentoo Linux system.

I have in my .emacs file these lines:
;; Toggle WikiLink on and off
(defun emacs-wiki-unlink-toggle ()
      "Toggle <nop> string in the beginning of the current word, to un/make a
    word emacs-wiki link. The current word depends on the point: if the cursor
    is on a non-whitespace character, it's considered a word surrounded by
    whitespace. If the cursor is on a whitespace character, the next word is
    looked up. This way addressing a word works intuitively after having
    arrived on the spot using forward-word."
    (if (looking-at "[[:space:]]")
        (goto-char (- (re-search-forward "[A-Za-z<]") 1))
      (goto-char (+ (re-search-backward "[[:space:]]") 1)))
    (if (looking-at "<nop>")
        (delete-char 5)
      (insert "<nop>"))))

(add-hook 'emacs-wiki-mode-hook
      '(lambda () (local-set-key "\C-c\C-n" 'emacs-wiki-unlink-toggle)))

but in Wiki mode I can't toggle on or off a WikiLink.

Best, Pali

reply via email to

[Prev in Thread] Current Thread [Next in Thread]