From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Sandip Chitale" Newsgroups: gmane.emacs.help Subject: Re: word delimiter Date: Wed, 05 Mar 2003 07:27:57 GMT Organization: AT&T Broadband Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <1Gh9a.358932$HN5.1532011@rwcrnsc51.ops.asp.att.net> References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1046849548 19336 80.91.224.249 (5 Mar 2003 07:32:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 5 Mar 2003 07:32:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 05 08:32:26 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18qTO5-00051X-00 for ; Wed, 05 Mar 2003 08:32:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18qTMl-00087p-00 for gnu-help-gnu-emacs@m.gmane.org; Wed, 05 Mar 2003 02:31:03 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 103 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Original-NNTP-Posting-Host: 12.235.67.53 Original-X-Complaints-To: abuse@attbi.com Original-X-Trace: rwcrnsc51.ops.asp.att.net 1046849277 12.235.67.53 (Wed, 05 Mar 2003 07:27:57 GMT) Original-NNTP-Posting-Date: Wed, 05 Mar 2003 07:27:57 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:110834 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7335 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7335 Here you go: (defun kill-symbol-forward () "Kill characters forward until encountering the end of a symbol." (interactive) (kill-region (point) (progn (call-interactively 'forward-symbol) (point)))) (defun kill-symbol-backward () "Kill characters backward until encountering the beginningof a symbol." (interactive) (kill-region (point) (progn (backward-symbol) (point)))) (global-set-key [(meta b)] 'kill-symbol-backward) (global-set-key [(meta d)] 'kill-symbol-forward) HTH, sandip "Sandip Chitale" wrote in message news:b607d812.0303041801.26fea909@posting.google.com... > I see that people are suggesting modifying the syntax of '_' to word. > It is related to the discussion if following thread: > > http://groups.google.com/groups?dq=&hl=en&lr=lang_en&ie=UTF-8&threadm=84bs0w piim.fsf%40lucy.is.informatik.uni-duisburg.de&prev=/groups%3Fdq%3D%26num%3D2 5%26hl%3Den%26lr%3Dlang_en%26ie%3DUTF-8%26group%3Dgnu.emacs.help%26start%3D2 5 > > Someone else suggested that modifying the syntax may be too drastic > because > it will affect other commands. Instead you should define new defuns > which > do the work. > > Here is some defuns I defined along the lines of what you want: > > (defun forward-symbol () > "Move forward over a symbol." > (interactive) > (forward-word 1) > (while (eq (char-syntax (following-char)) ?\_) > (forward-word 1) > ) > ) > > (defun backward-symbol () > "Move backward over a symbol." > (interactive) > (backward-word 1) > (while (eq (char-syntax (preceding-char)) ?\_) > (backward-word 1) > ) > ) > > (defun forward-symbol-append () > "" > (interactive) > (unless mark-active (set-mark (point))) > (call-interactively 'forward-symbol) > ) > > (defun backward-symbol-append () > "" > (interactive) > (unless mark-active (set-mark (point))) > (call-interactively 'backward-symbol) > ) > > (defun select-symbol-at-point () > "Select word at point." > (interactive) > (let ((syntax (char-syntax (following-char)))) > (if (or (eq syntax ?\w) > (eq syntax ?\_)) > (progn > (backward-symbol) > (set-mark (point)) > (forward-symbol-append) > ) > (progn > (skip-syntax-backward (char-to-string syntax)) > (set-mark (point)) > (skip-syntax-forward (char-to-string syntax)) > ) > ) > ) > ) > > (global-set-key [(meta f)] 'forward-symbol) > (global-set-key [(meta b)] 'backward-symbol) > (global-set-key [C-S-right] 'forward-symbol-append) > (global-set-key [C-S-left] 'backward-symbol-append) > (global-set-key [(meta control w)] 'select-symbol-at-point) > > > You should be able to adapt these for M-d. > > HTH, > sandip