all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Raffaele Ricciardi <rfflrccrd@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Symbols as words?
Date: Mon, 27 Aug 2012 14:57:11 +0100	[thread overview]
Message-ID: <aa1clnFdbsU1@mid.individual.net> (raw)
In-Reply-To: <876285iku4.fsf@kuiper.lan.informatimago.com>

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.


  reply	other threads:[~2012-08-27 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-08-27 14:53     ` Pascal J. Bourguignon

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=aa1clnFdbsU1@mid.individual.net \
    --to=rfflrccrd@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.
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.