From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: sam jesse Newsgroups: gmane.emacs.help Subject: Re: key binding for highlighting Date: Sat, 1 Aug 2009 09:34:34 +1000 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016363b845cd907d7047008dcb1 X-Trace: ger.gmane.org 1249099061 17139 80.91.229.12 (1 Aug 2009 03:57:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2009 03:57:41 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Richard Riley Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 01 05:57:34 2009 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 1MX5iu-0003Kj-S7 for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Aug 2009 05:57:33 +0200 Original-Received: from localhost ([127.0.0.1]:34600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX5iu-0001UR-9w for geh-help-gnu-emacs@m.gmane.org; Fri, 31 Jul 2009 23:57:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MX1cS-00015G-DC for help-gnu-emacs@gnu.org; Fri, 31 Jul 2009 19:34:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MX1cR-00014j-CJ for help-gnu-emacs@gnu.org; Fri, 31 Jul 2009 19:34:35 -0400 Original-Received: from [199.232.76.173] (port=35660 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MX1cR-00014g-8i for help-gnu-emacs@gnu.org; Fri, 31 Jul 2009 19:34:35 -0400 Original-Received: from qw-out-1920.google.com ([74.125.92.145]:24717) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MX1cQ-0006N9-Ml for help-gnu-emacs@gnu.org; Fri, 31 Jul 2009 19:34:34 -0400 Original-Received: by qw-out-1920.google.com with SMTP id 5so1594260qwf.24 for ; Fri, 31 Jul 2009 16:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Zx5wIeAHmBRWhALm9GZx4H0DQdmDoBpcBmRfmA+bLw4=; b=DpYmxnhmd23JphdeOT7Z92rW0q2qe+Ov7IlOWRACgiFdPn5yQVpAPmlCwSUZmUaogW 4mWWHpHDTBG+z68ttJI/HJMfM7pAUEKifTmDSaNrp6PcdFevyUBrhsqKo+b6pUrLXtu7 9dTwSQhTLq+LCVpyJUutDK8eHqVO2Jd1rNBO8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ZDm4pY43pR8BCRztd0q5aDTIkZXDRK3GL64Ogrp2y/U85cEddtWdutvOgCn+RoUpav AD9KA3bajtIn8168jbde9Kr87dJdIl960j2pwBnNzDw+ce6yTHGG/LNPyBRBRVqrYU2A S8N7Oe3sVUx2CZ+f9ovzT82/UdxUYbgmeoc+k= Original-Received: by 10.229.99.130 with SMTP id u2mr550298qcn.29.1249083274102; Fri, 31 Jul 2009 16:34:34 -0700 (PDT) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Fri, 31 Jul 2009 23:57:04 -0400 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:66607 Archived-At: --0016363b845cd907d7047008dcb1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit using GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600) of 2008-09-07 on SOFT-MJASON under window XP. the command to mark-word did not make the word at point. after googleing, I found this code which suppose to be fired M-8 to make the word, the next fire for the sentence and the 3rd fire for the whole paragraph. but it is not working in my system. please try on yours and report back. thx ;; by Nikolaj Schumacher, 2008-10-20. Released under GPL. (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)) ;; by Nikolaj Schumacher, 2008-10-20. Released under GPL. (defun extend-selection (arg &optional incremental) "Select the current word. Subsequent calls expands the selection to larger semantic unit." (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) (extend-selection (1- arg) t) (if (looking-at "\\=\\(\\s_\\|\\sw\\)*\\_>") (goto-char (match-end 0)) (unless (memq (char-before) '(?\) ?\")) (forward-sexp))) (mark-sexp -1)))) (global-set-key (kbd "M-8") 'extend-selection) ; code end ******** On Sat, Aug 1, 2009 at 7:41 AM, Richard Riley wrote: > sam jesse writes: > > > Hi > > > > what do I need to put in my .emacs so that when I hit say F5 key, emacs > highlights the word at the cursor? > > I will try to apply the same for the sentence with F6 and the paragraph > with F7. > > > > thanks > > > > You might want mark-word. > > You can then extend the selection ot just delete/copy etc. > --0016363b845cd907d7047008dcb1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable using GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600) of 2008-09-07 on SOFT-MJASON= under window XP.
the command to mark-word did not make the word at poin= t.

after googleing, I found this code which suppose to be fired M-8 to make the word, the next fire for the sentence and the 3rd fire for the whole paragraph. but it is not working in my system.
please try on yours and report back. thx

;; by Nikolaj Schumacher, 2= 008-10-20. Released under GPL.
(defun semnav-up (arg)
=A0 (interactiv= e "p")
=A0 (when (nth 3 (syntax-ppss))
=A0=A0=A0 (if (> = arg 0)
=A0=A0=A0=A0=A0=A0=A0 (progn
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (skip-syntax-fo= rward "^\"")
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (goto-char (1+ (= point)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (decf arg))
=A0=A0=A0=A0=A0 (ski= p-syntax-backward "^\"")
=A0=A0=A0=A0=A0 (goto-char (1- (= point)))
=A0=A0=A0=A0=A0 (incf arg)))
=A0 (up-list arg))

;; by Nikolaj Sch= umacher, 2008-10-20. Released under GPL.
(defun extend-selection (arg &a= mp;optional incremental)
=A0 "Select the current word.
Subsequen= t calls expands the selection to larger semantic unit."
=A0 (interactive (list (prefix-numeric-value current-prefix-arg)
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (or (and transient-m= ark-mode mark-active)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 (eq last-command this-command))))
=A0 (if incre= mental
=A0=A0=A0=A0=A0 (progn
=A0=A0=A0=A0=A0=A0=A0 (semnav-up (- arg))
=A0=A0=A0=A0=A0=A0=A0 (forward= -sexp)
=A0=A0=A0=A0=A0=A0=A0 (mark-sexp -1))
=A0=A0=A0 (if (> arg = 1)
=A0=A0=A0=A0=A0=A0=A0 (extend-selection (1- arg) t)
=A0=A0=A0=A0= =A0 (if (looking-at "\\=3D\\(\\s_\\|\\sw\\)*\\_>")
=A0=A0= =A0=A0=A0=A0=A0=A0=A0 (goto-char (match-end 0))
=A0=A0=A0=A0=A0=A0=A0 (unless (memq (char-before) '(?\) ?\"))
= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (forward-sexp)))
=A0=A0=A0=A0=A0 (mark-sexp = -1))))

(global-set-key (kbd "M-8") 'extend-selection)<= br>; code end ********

On Sat, Aug 1, 2009 at 7:41 AM, Richard Riley <rileyrgdev@gmail.com> wrote:=
sam jesse <revrvr@gmail.com> writes:

> Hi
>
> what do I need to put in my .emacs so that when I hit say F5 key, emac= s highlights the word at the cursor?
> I will try to apply the same for the sentence with F6 and the paragrap= h with F7.
>
> thanks
>

You might want mark-word.

You can then extend the selection ot just delete/copy etc.

--0016363b845cd907d7047008dcb1--