From unknown Thu Sep 11 09:18:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14427: 24.3.50; Highlight symbol at point 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: To: 14427@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.136909103617694 (code B ref -1); Mon, 20 May 2013 23:04:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 May 2013 23:03:56 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_40, USER_IN_WHITELIST autolearn=disabled version=3.3.2 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 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 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 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 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) From: Juri Linkov Organization: JURTA Date: Tue, 21 May 2013 01:54:34 +0300 Message-ID: <87ppwlb6tx.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain 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-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 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) ...). From unknown Thu Sep 11 09:18:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14427: 24.3.50; Highlight symbol at point 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:32: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: To: 14427@debbugs.gnu.org Received: via spool by 14427-submit@debbugs.gnu.org id=B14427.136909271621565 (code B ref 14427); Mon, 20 May 2013 23:32:02 +0000 Received: (at 14427) by debbugs.gnu.org; 20 May 2013 23:31:56 +0000 Received: from localhost ([127.0.0.1]:53584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UeZYZ-0005bm-V7 for submit@debbugs.gnu.org; Mon, 20 May 2013 19:31:56 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:46797 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UeZYW-0005bd-87 for 14427@debbugs.gnu.org; Mon, 20 May 2013 19:31:54 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id A485D258B9E91C for <14427@debbugs.gnu.org>; Mon, 20 May 2013 16:31:15 -0700 (PDT) From: Juri Linkov Organization: JURTA References: <87ppwlb6tx.fsf@mail.jurta.org> Date: Tue, 21 May 2013 02:28:21 +0300 In-Reply-To: <87ppwlb6tx.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 21 May 2013 01:54:34 +0300") Message-ID: <87ip2d9qp6.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) BTW, the current symbol is incorrectly highlighted when `hi-lock-face-buffer' is called from isearch. This should be fixed by this patch: === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-05-18 22:46:59 +0000 +++ lisp/isearch.el 2013-05-20 23:27:28 +0000 @@ -1773,7 +1791,10 @@ (defun isearch-highlight-regexp () (isearch-done nil t) (isearch-clean-overlays)) (require 'hi-lock nil t) - (let ((string (cond (isearch-regexp isearch-string) + (let ((string (cond ((functionp isearch-word) + (funcall isearch-word isearch-string)) + (isearch-word (word-search-regexp isearch-string)) + (isearch-regexp isearch-string) ((if (and (eq isearch-case-fold-search t) search-upper-case) (isearch-no-upper-case-p It still can't correctly set `case-fold-search' for hi-lock, but this can't be improved because hi-lock is based on font-lock when font-lock is enabled in the buffer, and changing `font-lock-keywords-case-fold-search' to the same value as `isearch-case-fold-search' might break font-lock highlighting for its other default keywords. From unknown Thu Sep 11 09:18:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14427: 24.3.50; Highlight symbol at point Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 May 2013 19:16:01 +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 To: 14427@debbugs.gnu.org Received: via spool by 14427-submit@debbugs.gnu.org id=B14427.136916375824937 (code B ref 14427); Tue, 21 May 2013 19:16:01 +0000 Received: (at 14427) by debbugs.gnu.org; 21 May 2013 19:15:58 +0000 Received: from localhost ([127.0.0.1]:55047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ues2Q-0006UA-9x for submit@debbugs.gnu.org; Tue, 21 May 2013 15:15:58 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:49861 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ues2N-0006U0-0u for 14427@debbugs.gnu.org; Tue, 21 May 2013 15:15:56 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 4C653258B9E938 for <14427@debbugs.gnu.org>; Tue, 21 May 2013 12:15:12 -0700 (PDT) From: Juri Linkov Organization: JURTA References: <87ppwlb6tx.fsf@mail.jurta.org> <87ip2d9qp6.fsf@mail.jurta.org> Date: Tue, 21 May 2013 22:07:49 +0300 In-Reply-To: <87ip2d9qp6.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 21 May 2013 02:28:21 +0300") Message-ID: <87r4h0jgmy.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) The intention was to accompany the proposed `highlight-symbol-at-point' with its isearch correlate. This feature was requested long ago in http://www.emacswiki.org/emacs/SearchAtPoint and after recent improvements it is straightforward to implement now. For keybindings it makes sense to take the command `find-tag' as a model with its keybinding `M-.' since `find-tag' searches for a tag in source code and `isearch-forward-symbol-at-point' and `highlight-symbol-at-point' should do the same only in the current buffer: M-. - find-tag M-s . - isearch-forward-symbol-at-point M-s h . - highlight-symbol-at-point === modified file 'lisp/bindings.el' --- lisp/bindings.el 2013-04-22 04:17:30 +0000 +++ lisp/bindings.el 2013-05-21 19:05:45 +0000 @@ -892,6 +892,7 @@ (define-key esc-map "s" search-map) (define-key search-map "o" 'occur) (define-key search-map "hr" 'highlight-regexp) +(define-key search-map "h." 'highlight-symbol-at-point) (define-key search-map "hp" 'highlight-phrase) (define-key search-map "hl" 'highlight-lines-matching-regexp) (define-key search-map "hu" 'unhighlight-regexp) === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-05-18 22:46:59 +0000 +++ lisp/isearch.el 2013-05-21 18:59:23 +0000 @@ -677,6 +677,7 @@ (define-key global-map "\C-r" 'isearch-b (define-key esc-map "\C-r" 'isearch-backward-regexp) (define-key search-map "w" 'isearch-forward-word) (define-key search-map "_" 'isearch-forward-symbol) +(define-key search-map "." 'isearch-forward-symbol-at-point) ;; Entry points to isearch-mode. @@ -817,6 +818,25 @@ (defun isearch-backward-regexp (&optiona (interactive "P\np") (isearch-mode nil (null not-regexp) nil (not no-recursive-edit))) +(defun isearch-forward-symbol-at-point () + "Do incremental search forward for a symbol found near point. +Like ordinary incremental search except that the symbol found at point +is added to the search string initially as a regexp surrounded +by symbol boundary constructs \\_< and \\_>. +See the command `isearch-forward-symbol' for more information." + (interactive) + (isearch-forward-symbol nil 1) + (let ((bounds (find-tag-default-bounds))) + (cond + (bounds + (when (< (car bounds) (point)) + (goto-char (car bounds))) + (isearch-yank-string + (buffer-substring-no-properties (car bounds) (cdr bounds)))) + (t + (setq isearch-error "No symbol at point") + (isearch-update))))) + ;; isearch-mode only sets up incremental search for the minor mode. ;; All the work is done by the isearch-mode commands. PS: One problem was that `find-tag-default' returns only a tag as a string, not its exact location, but it's necessary to move point to the beginning of the symbol. To solve this problem, another patch splits `find-tag-default' with part of code moved to `find-tag-default-bounds' that returns the beginning anf end of the found tag: === modified file 'lisp/subr.el' --- lisp/subr.el 2013-05-18 22:46:59 +0000 +++ lisp/subr.el 2013-05-21 19:07:07 +0000 @@ -2717,9 +2717,7 @@ (defsubst buffer-narrowed-p () "Return non-nil if the current buffer is narrowed." (/= (- (point-max) (point-min)) (buffer-size))) -(defun find-tag-default () - "Determine default tag to search for, based on text at point. -If there is no plausible default, return nil." +(defun find-tag-default-bounds () (let (from to bound) (when (or (progn ;; Look at text around `point'. @@ -2742,7 +2740,14 @@ (defun find-tag-default () (< (setq from (point)) bound) (skip-syntax-forward "w_") (setq to (point))))) - (buffer-substring-no-properties from to)))) + (cons from to)))) + +(defun find-tag-default () + "Determine default tag to search for, based on text at point. +If there is no plausible default, return nil." + (let ((bounds (find-tag-default-bounds))) + (when bounds + (buffer-substring-no-properties (car bounds) (cdr bounds))))) (defun find-tag-default-as-regexp () "Return regexp that matches the default tag at point. From unknown Thu Sep 11 09:18:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14427: 24.3.50; Highlight symbol at point 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 To: Juri Linkov Cc: 14427@debbugs.gnu.org Received: via spool by 14427-submit@debbugs.gnu.org id=B14427.137016741110442 (code B ref 14427); Sun, 02 Jun 2013 10:04:02 +0000 Received: (at 14427) by debbugs.gnu.org; 2 Jun 2013 10:03:31 +0000 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 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 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) 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) From: Jambunathan K References: <87ppwlb6tx.fsf@mail.jurta.org> Date: Sun, 02 Jun 2013 15:31:48 +0530 In-Reply-To: <87ppwlb6tx.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 21 May 2013 01:54:34 +0300") Message-ID: <87vc5wvnjn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.2 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) 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) ...). > From unknown Thu Sep 11 09:18:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14427: 24.3.50; Highlight symbol at point 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:07:01 +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 To: Juri Linkov Cc: 14427@debbugs.gnu.org Received: via spool by 14427-submit@debbugs.gnu.org id=B14427.137016756910915 (code B ref 14427); Sun, 02 Jun 2013 10:07:01 +0000 Received: (at 14427) by debbugs.gnu.org; 2 Jun 2013 10:06:09 +0000 Received: from localhost ([127.0.0.1]:47355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uj5Au-0002pw-EZ for submit@debbugs.gnu.org; Sun, 02 Jun 2013 06:06:09 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:47568) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Uj5At-0002pN-0y for 14427@debbugs.gnu.org; Sun, 02 Jun 2013 06:06:07 -0400 Received: by mail-pd0-f170.google.com with SMTP id x10so4333457pdj.15 for <14427@debbugs.gnu.org>; Sun, 02 Jun 2013 03:04:15 -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=z50Lzu9UCeoXA/MSbPV3Vk/rjcQxN6JRIXwHL7tcsQk=; b=qMkeXwss3aCFIaOFoD6rMXy+hnlC3/0lrTlDtVesug0N1AsJJfEgj5W1tsv4E4/CbT 0sDR5Rp5NvDaPgPeccZBwCvRkp4uEYJ4Iv/Old/ezCX42otLV+ctBWhqVFg/Lq900VZt GXuLPudgboYkIRi7lw7BV2dGCxN/9c4xb+YVJ93mNdKur2keQ050WsvizAs5L3oRzGzx DjUZZkTJRFIMQYfQGyC+AHXURNqxG4vd2Kr/Tva3ShKCiQlQ8ZWQswAL6zVdUBAZEnVU iDAHyGdZqbAoNg6E26XE071P2FR+glaHpJPcCB+/r6kSItgfbqSs39muSLrApwh0Zcy6 UwYA== X-Received: by 10.66.232.196 with SMTP id tq4mr20725455pac.167.1370167455678; Sun, 02 Jun 2013 03:04:15 -0700 (PDT) Received: from debian-6.05 ([115.242.187.176]) by mx.google.com with ESMTPSA id at1sm54492783pbc.10.2013.06.02.03.04.13 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 02 Jun 2013 03:04:15 -0700 (PDT) From: Jambunathan K References: <87ppwlb6tx.fsf@mail.jurta.org> <87vc5wvnjn.fsf@gmail.com> Date: Sun, 02 Jun 2013 15:34:28 +0530 In-Reply-To: <87vc5wvnjn.fsf@gmail.com> (Jambunathan K.'s message of "Sun, 02 Jun 2013 15:31:48 +0530") Message-ID: <87bo7oltg3.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Jambunathan K writes: > If you could commit this change, I can start using it right away. Small note. I haven't tested the isearch portions of the patch. From unknown Thu Sep 11 09:18:24 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Juri Linkov Subject: bug#14427: closed (Re: bug#14427: 24.3.50; Highlight symbol at point) Message-ID: References: <87zjv7a82a.fsf@mail.jurta.org> <87ppwlb6tx.fsf@mail.jurta.org> X-Gnu-PR-Message: they-closed 14427 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 14427@debbugs.gnu.org Date: Mon, 03 Jun 2013 08:58:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1370249882-11637-1" This is a multi-part message in MIME format... ------------=_1370249882-11637-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #14427: 24.3.50; Highlight symbol at point which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 14427@debbugs.gnu.org. --=20 14427: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14427 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1370249882-11637-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 14427-done) by debbugs.gnu.org; 3 Jun 2013 08:57:37 +0000 Received: from localhost ([127.0.0.1]:48463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjQa8-0002zu-VC for submit@debbugs.gnu.org; Mon, 03 Jun 2013 04:57:37 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:40956 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjQa5-0002zW-7B for 14427-done@debbugs.gnu.org; Mon, 03 Jun 2013 04:57:35 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id D4849258B9E91C; Mon, 3 Jun 2013 01:55:39 -0700 (PDT) From: Juri Linkov To: Jambunathan K Subject: Re: bug#14427: 24.3.50; Highlight symbol at point Organization: JURTA References: <87ppwlb6tx.fsf@mail.jurta.org> <87vc5wvnjn.fsf@gmail.com> <87bo7oltg3.fsf@gmail.com> Date: Mon, 03 Jun 2013 11:54:05 +0300 In-Reply-To: <87bo7oltg3.fsf@gmail.com> (Jambunathan K.'s message of "Sun, 02 Jun 2013 15:34:28 +0530") Message-ID: <87zjv7a82a.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14427-done Cc: 14427-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> If you could commit this change, I can start using it right away. Thanks for the reminder, this is installed now. > Small note. I haven't tested the isearch portions of the patch. Isearch integration with hi-lock is far from ideal yet. The limiting factor is that hi-lock is based on font-lock when font-lock is enabled. Otherwise, it is plain search-based. Perhaps we should check in `isearch-highlight-regexp' whether font-lock is active in the current buffer, and when font-lock is disabled then let-bind all relevant search variables like `lax-whitespace', `search-invisible', filters, etc. So search-based hi-lock will be able to highlight correctly the same matches as isearch. This will provide the correct conversion of the search parameters to hi-lock (at least partly for the case when font-lock is disabled and hi-lock is search-based). ------------=_1370249882-11637-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 May 2013 23:03:56 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_40, USER_IN_WHITELIST autolearn=disabled version=3.3.2 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 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 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 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 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) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 24.3.50; Highlight symbol at point Organization: JURTA Date: Tue, 21 May 2013 01:54:34 +0300 Message-ID: <87ppwlb6tx.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain 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-Received-From: 208.118.235.17 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 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) ...). ------------=_1370249882-11637-1--