From: "Csányi Pál" <csanyipal@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Toggle WikiLink on and off does not work?
Date: Fri, 18 Aug 2017 07:06:31 +0200 [thread overview]
Message-ID: <CAONhAosWkH310iNRj+VcS_1X4TtxFxeGkr4iuV0BLaQdRZvstQ@mail.gmail.com> (raw)
In-Reply-To: <86vallvqyd.fsf@zoho.com>
2017-08-17 23:12 GMT+02:00 Emanuel Berg <moasen@zoho.com>:
> Csányi Pál wrote:
>
>> It is all the same whether is a <nop> before
>> a CamelCase or is not there, the CamelCase
>> remain wikilink. I expect that, if a <nop> is
>> before a such CamelCase, like <nop>CamelCase
>> then it should turn into non-link. Right?
>> This turn thing does not works here.
>
> There is nothing specifically about CamelCase
> in that function!
>
> Can you give us a piece of code and tell where
> point is and what you want to happen when the
> function is invoked?
As you know, I am not who wrote this code down, but yason:
Toggle WikiLink on and off
Depending on the type of the text you write, you might be typing a lot
of CamelCase words that are, however, not links. Writing <nop> is
cumbersome after a few iterations, and sometimes you’ll have to remove
it again. Here’s a short function that toggles the current CamelCaps
word between wikilink and non-link:
(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."
(interactive)
(save-excursion
(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>"))))
I hook it up to C-n with this:
(add-hook 'emacs-wiki-mode-hook
'(lambda () (local-set-key "\C-c\C-n" 'emacs-wiki-unlink-toggle)))
--yason
> This issue is a bit trivial - why not just
> type? - but OK, I sense it has a trivial
> solution as well where that function
> fails... :)
In Wiki Mode if one write down a CamelCase word, it turns
automatically in to wikilink.
I thought the code abowe was for turning off wikilink into non-link in
such case when one want to write down a CamelCase word in Wiki Mode,
but want it not to be a wikilink.
If this code write down by yason does this not, then what is it for??
What is the purpose of the <nop> at the start of such CamelCase word
in Wiki Mode then??
--
Best, Pali
next prev parent reply other threads:[~2017-08-18 5:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 8:55 Toggle WikiLink on and off does not work? Csányi Pál
2017-08-16 14:50 ` Emanuel Berg
2017-08-16 15:32 ` Emanuel Berg
2017-08-17 8:17 ` Csányi Pál
2017-08-17 11:42 ` Emanuel Berg
2017-08-17 18:53 ` Csányi Pál
2017-08-17 21:12 ` Emanuel Berg
2017-08-18 5:06 ` Csányi Pál [this message]
2017-08-19 14:13 ` Emanuel Berg
2017-08-19 14:41 ` Csányi Pál
2017-08-19 14:52 ` Emanuel Berg
2017-08-19 15:15 ` Csányi Pál
2017-08-17 11:54 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAONhAosWkH310iNRj+VcS_1X4TtxFxeGkr4iuV0BLaQdRZvstQ@mail.gmail.com \
--to=csanyipal@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.