[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c-mode and underscore
From: |
Xah Lee |
Subject: |
Re: c-mode and underscore |
Date: |
Tue, 7 Jul 2009 19:16:26 -0700 (PDT) |
User-agent: |
G2/1.0 |
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/
☄