From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#14427: 24.3.50; Highlight symbol at point Date: Tue, 21 May 2013 01:54:34 +0300 Organization: JURTA Message-ID: <87ppwlb6tx.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369091014 1846 80.91.229.3 (20 May 2013 23:03:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 May 2013 23:03:34 +0000 (UTC) To: 14427@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 21 01:03:33 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 1UeZ76-0000bH-3i for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 May 2013 01:03:32 +0200 Original-Received: from localhost ([::1]:36944 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeZ75-0005Bd-MO for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 May 2013 19:03:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeZ72-0005BR-Df for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:03:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeZ70-0000ww-VS for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:03:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeZ70-0000ws-Sg for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:03:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UeZ7Z-0004bj-Tr for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 May 2013 23:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14427 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.136909103617694 (code B ref -1); Mon, 20 May 2013 23:04:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 May 2013 23:03:56 +0000 Original-Received: from localhost ([127.0.0.1]:53555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UeZ7T-0004bG-4R for submit@debbugs.gnu.org; Mon, 20 May 2013 19:03:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49192) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UeZ7Q-0004b4-Tl for submit@debbugs.gnu.org; Mon, 20 May 2013 19:03:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeZ6l-0000qk-OR for submit@debbugs.gnu.org; Mon, 20 May 2013 19:03:12 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:46519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeZ6l-0000qX-LU for submit@debbugs.gnu.org; Mon, 20 May 2013 19:03:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeZ6k-0005AZ-DI for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:03:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeZ6j-0000jy-EO for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:03:10 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:45472 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeZ6j-0000hE-8G for bug-gnu-emacs@gnu.org; Mon, 20 May 2013 19:03:09 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 64580258B9E938 for ; Mon, 20 May 2013 16:03:07 -0700 (PDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:74424 Archived-At: 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) ...).