From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raffaele Ricciardi Newsgroups: gmane.emacs.help Subject: Re: Symbols as words? Date: Mon, 27 Aug 2012 14:57:11 +0100 Message-ID: References: <876285iku4.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1346076033 11115 80.91.229.3 (27 Aug 2012 14:00:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Aug 2012 14:00:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 27 16:00:34 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T5zrh-0001vT-2F for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Aug 2012 16:00:29 +0200 Original-Received: from localhost ([::1]:43654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5zrf-0000h1-2t for geh-help-gnu-emacs@m.gmane.org; Mon, 27 Aug 2012 10:00:27 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-X-Trace: individual.net auKEpY67UZ08gACT0NmDrQrj3HmJZy0evZYrSN8bzEirzhQNGfETFQAsnwMdHNjJYA Cancel-Lock: sha1:e+hj/cAWnCsbVmRKtjkSZ2O99sw= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <876285iku4.fsf@kuiper.lan.informatimago.com> Original-Xref: usenet.stanford.edu gnu.emacs.help:194184 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86549 Archived-At: 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.