From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: How do I highlight word at point? Date: Mon, 20 Oct 2008 11:43:55 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9d7c202b-1851-4a3d-a895-de41c876e314@s9g2000prm.googlegroups.com> References: <1224382569.209484@nntp.acecape.com> <8403dd42-f1a6-41fa-91d0-fa8b2a873932@u40g2000pru.googlegroups.com> <1ed6498a-19fc-42f2-b00c-b369e74396b1@p10g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1224536389 11941 80.91.229.12 (20 Oct 2008 20:59:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Oct 2008 20:59:49 +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 Oct 20 23:00:48 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ks0dK-0000eS-3m for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Oct 2008 21:41:42 +0200 Original-Received: from localhost ([127.0.0.1]:45396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ks0cE-0004fY-RY for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Oct 2008 15:40:34 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!s9g2000prm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1224528236 1714 127.0.0.1 (20 Oct 2008 18:43:56 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 20 Oct 2008 18:43:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s9g2000prm.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163619 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58959 Archived-At: On Oct 20, 5:31 am, Nikolaj Schumacher wrote: > Xah wrote: > > is it possible to make it work with selecting a string? > > Yes. It seems so, but the code gets very complicated if you try to do > the right thing in all places. For instance, inside strings, you might > prefer the text-mode syntax table for best results. > > I've written a bit more of this and might turn it into a package once it'= s > more tested. > > (defun semnav-up (arg) > (interactive "p") > (when (nth 3 (syntax-ppss)) > (if (> arg 0) > (progn > (skip-syntax-forward "^\"") > (goto-char (1+ (point))) > (decf arg)) > (skip-syntax-backward "^\"") > (goto-char (1- (point))) > (incf arg))) > (up-list arg)) > > (defun semnav-mark (arg &optional incremental) > "Mark the symbol surrounding point. > Subsequent calls mark higher levels of sexps." > (interactive (list (prefix-numeric-value current-prefix-arg) > (or (and transient-mark-mode mark-active) > (eq last-command this-command)))) > (if incremental > (progn > (semnav-up (- arg)) > (forward-sexp) > (mark-sexp -1)) > (if (> arg 1) > (semnav-mark (1- arg) t) > (if (looking-at "\\=3D\\(\\s_\\|\\sw\\)*\\_>") > (goto-char (match-end 0)) > (unless (memq (char-before) '(?\) ?\")) > (forward-sexp))) > (mark-sexp -1)))) ummm... doesn't seems to work? suppose i have ( "this that" [more ]) and cursor is on the word =E2=80=9Cthat=E2=80=9D. I invoke this command twice, it selects the whole paren? Xah =E2=88=91 http://xahlee.org/ =E2=98=84