all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* What is a word?
@ 2015-05-12 19:55 Florian Lindner
  2015-05-12 20:01 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Lindner @ 2015-05-12 19:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

ofter I find it, that the emacs function acting on a word not behave like I 
expect.

I'm not sure if the definiton of a word is major-mode dependent?

Talking about kill-word, forward-word and alike.

Example, | represents cursor position, shell-script mode:

cd $BASE| -> backward-kill-word cd $|
;; what I expected

cd $| -> backward-kill-word -> |
;; not what I expected, rather expected only the $, with or without the 
whitespace between cd, same for "cd .."

Very much disturbing I find, is killing over linebreaks (python-mode):

    |])
        return True

above being remains from previous kills, | is still cursor. kill-word does:

    | True

In generell the word functions are too greedy.

I don't know if I want to try to change that... Is there a quick fix?

But want to know what's emacs model of a word and what's wrong with mine.

Best Regards,
Florian




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What is a word?
  2015-05-12 19:55 What is a word? Florian Lindner
@ 2015-05-12 20:01 ` Eli Zaretskii
  2015-05-12 20:26   ` Jorge A. Alfaro-Murillo
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2015-05-12 20:01 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Florian Lindner <mailinglists@xgm.de>
> Date: Tue, 12 May 2015 21:55:44 +0200
> 
> ofter I find it, that the emacs function acting on a word not behave like I 
> expect.
> 
> I'm not sure if the definiton of a word is major-mode dependent?
> 
> Talking about kill-word, forward-word and alike.
> 
> Example, | represents cursor position, shell-script mode:
> 
> cd $BASE| -> backward-kill-word cd $|
> ;; what I expected
> 
> cd $| -> backward-kill-word -> |
> ;; not what I expected, rather expected only the $, with or without the 
> whitespace between cd, same for "cd .."

Each major mode defines its own word-constituent characters.  In
general, any character that can appear in a symbol recognized by the
programming language of the mode is a word-constituent character in
that mode.

So "word" has different meanings in different major modes.  For
example, the '-' character is word-constituent in Lisp, but not in C.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What is a word?
  2015-05-12 20:01 ` Eli Zaretskii
@ 2015-05-12 20:26   ` Jorge A. Alfaro-Murillo
  0 siblings, 0 replies; 3+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-05-12 20:26 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii writes:

>> From: Florian Lindner <mailinglists@xgm.de> Date: Tue, 12 May 
>> 2015 21:55:44 +0200  ofter I find it, that the emacs function 
>> acting on a word not behave like I  expect.   I'm not sure if 
>> the definiton of a word is major-mode dependent?   Talking 
>> about kill-word, forward-word and alike.
[...] 
 
> Each major mode defines its own word-constituent characters.  In 
> general, any character that can appear in a symbol recognized by 
> the programming language of the mode is a word-constituent 
> character in that mode. 
> 
> So "word" has different meanings in different major modes.  For 
> example, the '-' character is word-constituent in Lisp, but not 
> in C.

Also some minor modes affect the meaning of word, for example the 
minor mode subword-mode changes the definition of word so it 
respects the CamelCase convention.

-- 
Jorge.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-12 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 19:55 What is a word? Florian Lindner
2015-05-12 20:01 ` Eli Zaretskii
2015-05-12 20:26   ` Jorge A. Alfaro-Murillo

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.