From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Property for treating a string as a single character when deleting
Date: Tue, 12 Aug 2014 05:33:32 +0200 [thread overview]
Message-ID: <87fvh2crg3.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: mailman.6973.1407769404.1147.help-gnu-emacs@gnu.org
Tom <adatgyujto@gmail.com> writes:
> Is there a property or some other way to treat a string
> as a single character? I know I can add the intangible
> property and then cursor movements jumps over the string
> like its a single character. Is there a property for
> making the string behave like this for deletion too?
> So, for example, when I backspace at the rightmost
> character of the string then the whole string is deleted
> at once like it's a single character.
It would depend on what your "string" is.
If it's a syntactic string like in programming languages, that is
quoted, eg. "this is a string", then you can use the sexp commands.
forward-sexp, backward-sexp, kill-sexp, etc. But this works only in
those programming language modes. text-mode doesn't recognize them as
sexps. (forward-sexp skips words, not quoted strings).
If it's a "word", as defined by the current mode, then you can use the
word commands, forward-word, backward-word, kill-word, etc.
It may also be a "paragraph", and the you can use forward-paragraph,
backward-paragraph, kill-paragraph, etc.
C-f C-b C-d DEL character
M-f M-b M-d M-DEL word
C-M-f C-M-b C-M-d sexp
M-} M-{ paragraph
If you can come with a definition for your strings, then you can write
commands like those, to skip over those strings and manipulate them
(delete, select, etc). If your definition is close to that of word,
sexp or paragraph, you may be able to make a derivate of your mode,
tuning its understanding of those concepts. (Words are defined by the
syntax table of the mode).
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
next prev parent reply other threads:[~2014-08-12 3:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.6973.1407769404.1147.help-gnu-emacs@gnu.org>
2014-08-11 21:29 ` Property for treating a string as a single character when deleting Emanuel Berg
2014-08-12 3:33 ` Pascal J. Bourguignon [this message]
2014-08-11 15:02 Tom
2014-08-12 2:16 ` Stefan Monnier
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=87fvh2crg3.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.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.