From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: c-mode and underscore
Date: Tue, 7 Jul 2009 19:16:26 -0700 (PDT) [thread overview]
Message-ID: <03ed2840-29a9-4ee2-95f4-df57bcd2e985@z4g2000prh.googlegroups.com> (raw)
In-Reply-To: 9168430a-e1d0-4f6c-8b4f-4eae95e4b239@h2g2000yqg.googlegroups.com
On Jul 7, 3:56 pm, geophile <jack.orenst...@gmail.com> wrote:
> I am trying to get c-mode to treat underscore as a word, so that
> forward-word backward-word don't stop on underscores.
>
> My .emacs file includes:
>
> (modify-syntax-entry ?_ "w" c-mode-syntax-table)
>
> which does not appear to be effective. But if I run this command
> manually, it is effective.
>
> I'm pretty sure that the line above is being reached in my .emacs
> file, as later commands are effective.
your code mod the global syntax table. you want to mode the syntax
table for that mode. It works when u call manually because when u are
in that mode, it mods that mod's syntax table.
hook is a good solution.
e.g.
(add-hook 'w3m-mode-hook
(lambda ()
(define-key w3m-mode-map (kbd "<up>") 'previous-line) ; was w3m-
previous-anchor. Use Shift+Tab.
(define-key w3m-mode-map (kbd "<down>") 'next-line) ; was w3m-next-
anchor. Use Tab.
(define-key w3m-mode-map (kbd "<left>") 'backward-char) ; was w3m-
view-previous-page. Use B.
(define-key w3m-mode-map (kbd "<right>") 'forward-char) ; was w3m-
view-this-url. Use Enter.
))
you want to find the syntax table name for that mode to modify.
Xah
∑ http://xahlee.org/
☄
next prev parent reply other threads:[~2009-07-08 2:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-07 22:56 c-mode and underscore geophile
2009-07-07 23:58 ` Miles Bader
2009-07-08 2:16 ` Xah Lee [this message]
2009-07-08 5:40 ` Kevin Rodgers
[not found] ` <mailman.2043.1247031632.2239.help-gnu-emacs@gnu.org>
2009-07-08 10:44 ` Xah Lee
2009-07-08 10:52 ` Alan Mackenzie
2009-07-08 18:57 ` geophile
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03ed2840-29a9-4ee2-95f4-df57bcd2e985@z4g2000prh.googlegroups.com \
--to=xahlee@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).