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#11095: 24.0.94; hi-lock-face-buffer/unhighlight-regexp': Augment? Date: Fri, 12 Oct 2012 10:00:07 +0530 Message-ID: <87lifc71o0.fsf@gmail.com> References: <81d37z271c.fsf@gmail.com> <87y5jcvjsx.fsf@gmail.com> <87zk3s1vjz.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1350016160 18523 80.91.229.3 (12 Oct 2012 04:29:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Oct 2012 04:29:20 +0000 (UTC) Cc: 11095@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 12 06:29:27 2012 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 1TMWsI-0002VP-80 for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Oct 2012 06:29:26 +0200 Original-Received: from localhost ([::1]:54719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMWsB-0001Um-QS for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Oct 2012 00:29:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMWs8-0001UV-Rr for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 00:29:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMWs6-0007s2-LI for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 00:29:16 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMWs6-0007rs-GU for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 00:29:14 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TMWss-00086o-9Y for bug-gnu-emacs@gnu.org; Fri, 12 Oct 2012 00:30: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: Fri, 12 Oct 2012 04:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11095 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11095-submit@debbugs.gnu.org id=B11095.135001617131108 (code B ref 11095); Fri, 12 Oct 2012 04:30:02 +0000 Original-Received: (at 11095) by debbugs.gnu.org; 12 Oct 2012 04:29:31 +0000 Original-Received: from localhost ([127.0.0.1]:40159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMWsN-00085h-DL for submit@debbugs.gnu.org; Fri, 12 Oct 2012 00:29:31 -0400 Original-Received: from mail-pa0-f44.google.com ([209.85.220.44]:59743) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMWsL-00085V-BG for 11095@debbugs.gnu.org; Fri, 12 Oct 2012 00:29:30 -0400 Original-Received: by mail-pa0-f44.google.com with SMTP id fb11so2440600pad.3 for <11095@debbugs.gnu.org>; Thu, 11 Oct 2012 21:28:35 -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=zDnwA9Yz4RRlq63KO2R0m04OUVypweJaCgOG5+ZmRXg=; b=iXep7z0XBQfdlMNd6y5ADKFGXu1FbqsIIGoyOemBsldW9fX6lw+xRqU5MVfy0a0X/B FVtWwIiwxUSzxRTJRK9CEPTnGoKTOXmDUilTVrczTwVIVVnPTCvoqT3WR1p2I+A2fweM I/mRd1ZqXYgIjdkh46EO9iNwcZhzK+wFMbcd3QsRoWlhjdkfvdT32p7n7zwYS0OvWHIv 7tJjlzVxKH2qp9pkwdcweEejtB0WW47rdfr/u0NDu5GeKIUnt+72nJn9L5j9EKft2sAa QWemCRCMFP9et1L46AcHj+MgnNFdsmfmTKXy0TCtpKDypMESg5fW5oAXpFuPO/dKFUwC HNYw== Original-Received: by 10.68.252.133 with SMTP id zs5mr9945127pbc.152.1350016115424; Thu, 11 Oct 2012 21:28:35 -0700 (PDT) Original-Received: from debian-6.05 ([115.242.179.178]) by mx.google.com with ESMTPS id qj6sm2997283pbb.69.2012.10.11.21.28.32 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 11 Oct 2012 21:28:34 -0700 (PDT) In-Reply-To: <87zk3s1vjz.fsf@mail.jurta.org> (Juri Linkov's message of "Fri, 12 Oct 2012 01:41:04 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.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 (newer, 2) 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:65508 Archived-At: Juri Linkov writes: >> The patch allows highlighting of tag at point. (Note that for all >> practical purposes, tag at point is the symbol at point.) See >> Part_I/Item-2 below for a usecase. >> [...] >> + (cond ((not tag) "") >> + ((eq tagf 'find-tag-default) >> + (format "\\_<%s\\_>" (regexp-quote tag))) >> [...] >>> As a programmer, I use highlighting to trace variable dependencies >>> within a function. For example, in the example below, after >>> highlighting the variables in __different__ faces, I will come to the >>> conclusion that "a" depends on "d" and "tmp". >>> >>> c = d; >>> b = c + tmp; >>> a = b; >>> >>> And I use this very often to track variables and how they get their >>> values from. >>> >>> If I were to use the default Emacs provided behaviour then I would >>> have to press M-n multiple times as I highlight more and more >>> symbols. (Typically I have 3-5 symbols highlighted before I turn off >>> highlighting.) > > Would you agree that a better way to implement your proposal is to add a new > command to hi-lock.el with a name like `highlight-symbol'? I mean there are > already such hi-lock commands as: > > 1. highlight-lines-matching-regexp (that corresponds to occur) > 2. highlight-regexp (that corresponds to isearch-forward-regexp) > 3. highlight-phrase (that corresponds to isearch-forward-word) > > what is currently missing is this command: > > 4. highlight-symbol (that corresponds to isearch-forward-symbol) > > Then both highlight-phrase and highlight-symbol could use internally > isearch functions that turn words and symbols into regexps > and that will do the right thing using search-upper-case and > search-whitespace-regexp. Have you tried the patches? With my current patches, M-s h r will highlight symbol at point (more precisely tag at point). It may not be the best thing, but achieves the task at hand. Let me emphasize that the patches are mostly concerned with easy and hands-off highlighting and un-highlighting (i.e., the highlighting process itself - the "how" - rather than "what (regexp)" is highlighted and how those regexes are composed.) So the patches are valid candidates for consideration, irrespective of your observations above. As for handling of regexes themselves, I will rather leave it to more experienced hands. ps: I have one more patch to circulate - wrt unhighlighting - before I leave the table open for further discussion. Once I get some initial comments, I can rework the changes and provide a (revised) consolidated patch.