* Symbols as words?
@ 2012-08-26 14:16 Raffaele Ricciardi
2012-08-26 14:35 ` Jude DaShiell
2012-08-26 18:12 ` Pascal J. Bourguignon
0 siblings, 2 replies; 7+ messages in thread
From: Raffaele Ricciardi @ 2012-08-26 14:16 UTC (permalink / raw
To: help-gnu-emacs
Hello,
what's the option to make Emacs consider symbols as words? In Viper mode, I
used to have:
(setq viper-syntax-preference 'extended)
"`extended' means Viper word constituents are symbols that are marked as
being
parts of words OR symbols in Emacs syntax tables. This is most
appropriate for
major modes intended for editing programs."
I've looked around (Emacs Manual, Emacswiki, web forums) and I've found
nothing
besides hacking the syntax tables entry by entry.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Symbols as words?
2012-08-26 14:16 Symbols as words? Raffaele Ricciardi
@ 2012-08-26 14:35 ` Jude DaShiell
2012-08-26 14:47 ` Raffaele Ricciardi
2012-08-26 18:12 ` Pascal J. Bourguignon
1 sibling, 1 reply; 7+ messages in thread
From: Jude DaShiell @ 2012-08-26 14:35 UTC (permalink / raw
To: Raffaele Ricciardi; +Cc: help-gnu-emacs
abbrev-mode might work in this case once a dictionary of abbreviations
is built or downloaded if available.
On Sun, 26 Aug 2012, Raffaele
Ricciardi wrote:
> Hello,
>
> what's the option to make Emacs consider symbols as words? In Viper mode, I
> used to have:
>
> (setq viper-syntax-preference 'extended)
>
> "`extended' means Viper word constituents are symbols that are marked as being
> parts of words OR symbols in Emacs syntax tables. This is most appropriate
> for
> major modes intended for editing programs."
>
> I've looked around (Emacs Manual, Emacswiki, web forums) and I've found
> nothing
> besides hacking the syntax tables entry by entry.
>
> Thanks.
>
>
jude <jdashiel@shellworld.net>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Symbols as words?
2012-08-26 14:35 ` Jude DaShiell
@ 2012-08-26 14:47 ` Raffaele Ricciardi
2012-08-26 15:54 ` Jambunathan K
0 siblings, 1 reply; 7+ messages in thread
From: Raffaele Ricciardi @ 2012-08-26 14:47 UTC (permalink / raw
To: Jude DaShiell; +Cc: help-gnu-emacs
On 26/08/12 15:35, Jude DaShiell wrote:
> abbrev-mode might work in this case once a dictionary of abbreviations
> is built or downloaded if available.
Thank you for your help, but that is not what I'm looking for. I'm looking
for a way to make commands that work on words - e.g. `forward-word',
`backward-word', `kill-word', etc. - work on symbols instead.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Symbols as words?
2012-08-26 14:47 ` Raffaele Ricciardi
@ 2012-08-26 15:54 ` Jambunathan K
0 siblings, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2012-08-26 15:54 UTC (permalink / raw
To: Raffaele Ricciardi; +Cc: help-gnu-emacs
Raffaele Ricciardi <rfflrccrd@gmail.com> writes:
> On 26/08/12 15:35, Jude DaShiell wrote:
>> abbrev-mode might work in this case once a dictionary of abbreviations
>> is built or downloaded if available.
>
> Thank you for your help, but that is not what I'm looking for. I'm looking
> for a way to make commands that work on words - e.g. `forward-word',
> `backward-word', `kill-word', etc. - work on symbols instead.
(add-hook 'c-mode-hook
(lambda ()
(modify-syntax-entry ?_ "w")))
,---- From (info "(elisp) Syntax Class Table")
| Symbol constituents: `_'
| Extra characters used in variable and command names along with word
| constituents. Examples include the characters `$&*+-_<>' in Lisp
| mode, which may be part of a symbol name even though they are not
| part of English words. In standard C, the only
| non-word-constituent character that is valid in symbols is
| underscore (`_').
`----
>
>
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Symbols as words?
2012-08-26 14:16 Symbols as words? Raffaele Ricciardi
2012-08-26 14:35 ` Jude DaShiell
@ 2012-08-26 18:12 ` Pascal J. Bourguignon
2012-08-27 13:57 ` Raffaele Ricciardi
1 sibling, 1 reply; 7+ messages in thread
From: Pascal J. Bourguignon @ 2012-08-26 18:12 UTC (permalink / raw
To: help-gnu-emacs
Raffaele Ricciardi <rfflrccrd@gmail.com> writes:
> Hello,
>
> what's the option to make Emacs consider symbols as words? In Viper mode, I
> used to have:
>
> (setq viper-syntax-preference 'extended)
>
> "`extended' means Viper word constituents are symbols that are marked
> as being
> parts of words OR symbols in Emacs syntax tables. This is most
> appropriate for
> major modes intended for editing programs."
>
> I've looked around (Emacs Manual, Emacswiki, web forums) and I've
> found nothing
> besides hacking the syntax tables entry by entry.
If you use forward-sexp C-M-f it skips over symbols instead of words M-f.
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Symbols as words?
2012-08-26 18:12 ` Pascal J. Bourguignon
@ 2012-08-27 13:57 ` Raffaele Ricciardi
2012-08-27 14:53 ` Pascal J. Bourguignon
0 siblings, 1 reply; 7+ messages in thread
From: Raffaele Ricciardi @ 2012-08-27 13:57 UTC (permalink / raw
To: help-gnu-emacs
On 26/08/12 19:12, Pascal J. Bourguignon wrote:
> If you use forward-sexp C-M-f it skips over symbols instead of words M-f.
This helps, thanks. Still, it feels weird that Emacs is oblivious to
symbols even
in Emacs Lisp code, not to mention that C-M- chords aren't super
comfortable.
So, since there is no option to customize this behaviour, I've written a
snippet
of code to do so for any programming mode. I would have preferred my
code to
scan the syntax table and convert symbol constituents to word constituents,
but I have not been able to figure out quickly the format of syntax tables,
therefore I've resorted to manually listing non-word graphic characters.
(defun rr-symbol-constituent-p (^char)
"Return non non nil if ^CHAR is a symbol constituent in the current
buffer's
syntax table."
(= (char-syntax ^char) ?_))
(defvar rr-graphic-non-word-char-list
(string-to-list "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
"List of characters besides letters and numbers that could be symbol
constituents according to syntax tables.")
(defun rr-symbols-to-words ()
"Make symbols act as words in the current buffer's syntax table."
(mapcar (lambda (^char)
(when (rr-symbol-constituent-p ^char)
(modify-syntax-entry ^char "w")))
rr-graphic-non-word-char-list))
Cheers.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Symbols as words?
2012-08-27 13:57 ` Raffaele Ricciardi
@ 2012-08-27 14:53 ` Pascal J. Bourguignon
0 siblings, 0 replies; 7+ messages in thread
From: Pascal J. Bourguignon @ 2012-08-27 14:53 UTC (permalink / raw
To: help-gnu-emacs
Raffaele Ricciardi <rfflrccrd@gmail.com> writes:
> On 26/08/12 19:12, Pascal J. Bourguignon wrote:
>> If you use forward-sexp C-M-f it skips over symbols instead of words M-f.
>
> This helps, thanks. Still, it feels weird that Emacs is oblivious to
> symbols even in Emacs Lisp code, not to mention that C-M- chords
> aren't super comfortable.
You can just trivially bind forward-sexp and backward-sexp to your own
confortable keys.
(global-set-key (kbd "<f5>") 'forward-sexp)
(global-set-key (kbd "<f6>") 'backward-sexp)
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-08-27 14:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-26 14:16 Symbols as words? Raffaele Ricciardi
2012-08-26 14:35 ` Jude DaShiell
2012-08-26 14:47 ` Raffaele Ricciardi
2012-08-26 15:54 ` Jambunathan K
2012-08-26 18:12 ` Pascal J. Bourguignon
2012-08-27 13:57 ` Raffaele Ricciardi
2012-08-27 14:53 ` Pascal J. Bourguignon
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.