From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.bugs Subject: bug#14427: 24.3.50; Highlight symbol at point Date: Sun, 02 Jun 2013 15:31:48 +0530 Message-ID: <87vc5wvnjn.fsf@gmail.com> References: <87ppwlb6tx.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1370167346 6381 80.91.229.3 (2 Jun 2013 10:02:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Jun 2013 10:02:26 +0000 (UTC) Cc: 14427@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 02 12:02:25 2013 Return-path: Envelope-to: geb-bug-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 1Uj57J-0008Gc-EI for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Jun 2013 12:02:25 +0200 Original-Received: from localhost ([::1]:39696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uj57J-0006Mf-1S for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Jun 2013 06:02:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uj57E-0006MT-I0 for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 06:02:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uj57B-0005pP-0Y for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 06:02:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uj57A-0005pK-TT for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 06:02:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Uj58s-0002kE-2q for bug-gnu-emacs@gnu.org; Sun, 02 Jun 2013 06:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jambunathan K Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Jun 2013 10:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14427 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 14427-submit@debbugs.gnu.org id=B14427.137016741110442 (code B ref 14427); Sun, 02 Jun 2013 10:04:02 +0000 Original-Received: (at 14427) by debbugs.gnu.org; 2 Jun 2013 10:03:31 +0000 Original-Received: from localhost ([127.0.0.1]:47351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uj58M-0002iM-JW for submit@debbugs.gnu.org; Sun, 02 Jun 2013 06:03:31 -0400 Original-Received: from mail-pb0-f47.google.com ([209.85.160.47]:34069) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uj58K-0002hH-2H for 14427@debbugs.gnu.org; Sun, 02 Jun 2013 06:03:29 -0400 Original-Received: by mail-pb0-f47.google.com with SMTP id rr4so4327552pbb.6 for <14427@debbugs.gnu.org>; Sun, 02 Jun 2013 03:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Gd//2jevh5iOGlroygn9BRcpHciCent96wIXCFdmY+4=; b=Kao6OFEO5+WghDoSQM123HLtoCjsa9sOEfrQakj2P1ZMwH7SIrkEq3WQAUr7KjE7ll UfgRvanIFjscIk81UxpKMhKX+OcptG4K9twc85j0iw5CfDhINCAVY50GlF1G6ZOMH73B 1y9636m/9nUMwGuvGFlR5ci1a9xh56odfZR2KLn+VlDfYIqSOglI8ioetMZb33H7N1kJ 4rY6U+MIH5XG9SqT4VkO7gv3O4cQkgMUbemNisZyLG4qRUFWdspNvvAZO8Yj9k6A2syA G3uLuos3onnMGpYBkEw2rrWbsBSGSsh4rgjpaxKeiJN7tuOZeNrfJdfQ6APMPVTU77nI Omhg== X-Received: by 10.68.135.231 with SMTP id pv7mr19603123pbb.108.1370167295867; Sun, 02 Jun 2013 03:01:35 -0700 (PDT) Original-Received: from debian-6.05 ([115.242.187.176]) by mx.google.com with ESMTPSA id eq4sm16219264pad.16.2013.06.02.03.01.33 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 02 Jun 2013 03:01:35 -0700 (PDT) In-Reply-To: <87ppwlb6tx.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 21 May 2013 01:54:34 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74748 Archived-At: If you could commit this change, I can start using it right away. I have no firm opinion on whether `hi-lock-auto-select-face' should come from user setting or be let bound. Remember to provide a keybinding in hi-lock mode. I suggest C-x w "dot". Juri Linkov writes: > This feature request mostly doesn't depend on the outcome of bug#14405. > I don't know why Jambunathan didn't propose this feature earlier, but it > logically follows from his other improvements in hi-lock.el, i.e. the > feature that doesn't ask for a face and automatically uses the next face > from the list of available faces suggests also a command that doesn't ask > for a symbol and automatically uses the symbol at point: > > === modified file 'lisp/hi-lock.el' > --- lisp/hi-lock.el 2013-03-31 13:34:35 +0000 > +++ lisp/hi-lock.el 2013-05-20 22:52:54 +0000 > @@ -483,6 +461,27 @@ (defun hi-lock-face-phrase-buffer (regex > (unless hi-lock-mode (hi-lock-mode 1)) > (hi-lock-set-pattern regexp face)) > > +;;;###autoload > +(defalias 'highlight-symbol-at-point 'hi-lock-face-symbol-at-point) > +;;;###autoload > +(defun hi-lock-face-symbol-at-point () > + "Set face of each match of the symbol at point. > +Use `find-tag-default-as-symbol-regexp' to retrieve the symbol at point. > +Use non-nil `hi-lock-auto-select-face' to retrieve the next face > +from `hi-lock-face-defaults' automatically. > + > +Use Font lock mode, if enabled, to highlight symbol at point. > +Otherwise, use overlays for highlighting. If overlays are used, > +the highlighting will not update as you type." > + (interactive) > + (let* ((regexp (hi-lock-regexp-okay > + (find-tag-default-as-symbol-regexp))) > + (hi-lock-auto-select-face t) > + (face (hi-lock-read-face-name))) > + (or (facep face) (setq face 'hi-yellow)) > + (unless hi-lock-mode (hi-lock-mode 1)) > + (hi-lock-set-pattern regexp face))) > + > (defun hi-lock-keyword->face (keyword) > (cadr (cadr (cadr keyword)))) ; Keyword looks like (REGEXP (0 'FACE) ...). >