From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#18697: 25.0.50; [PATCH] hi-lock interactive functions now default to the active region, if there is one Date: Sun, 12 Oct 2014 15:35:55 -0700 Message-ID: <87zjd0digk.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1413153446 26493 80.91.229.3 (12 Oct 2014 22:37:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Oct 2014 22:37:26 +0000 (UTC) To: 18697@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 13 00:37:20 2014 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 1XdRlP-0007pb-RZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Oct 2014 00:37:20 +0200 Original-Received: from localhost ([::1]:59294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdRlP-0007E0-FU for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 Oct 2014 18:37:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdRlF-0007D1-Ss for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:37:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdRl9-0002L4-A6 for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:37:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50658) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdRl9-0002Kn-6j for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XdRl8-00078l-IQ for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Oct 2014 22:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18697 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141315338027372 (code B ref -1); Sun, 12 Oct 2014 22:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Oct 2014 22:36:20 +0000 Original-Received: from localhost ([127.0.0.1]:42222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XdRkR-00077P-Iu for submit@debbugs.gnu.org; Sun, 12 Oct 2014 18:36:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55440) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XdRkP-00077H-NV for submit@debbugs.gnu.org; Sun, 12 Oct 2014 18:36:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdRkI-00026T-KG for submit@debbugs.gnu.org; Sun, 12 Oct 2014 18:36:17 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdRkI-00026N-HL for submit@debbugs.gnu.org; Sun, 12 Oct 2014 18:36:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdRkC-0007AA-Dc for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:36:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdRk6-00023w-Ja for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:36:04 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdRk6-00023P-7b for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 18:35:58 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by gateway2.nyi.internal (Postfix) with ESMTP id BAC3E2058B for ; Sun, 12 Oct 2014 18:35:56 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 12 Oct 2014 18:35:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:from:to:subject:date:message-id:mime-version :content-type; s=mesmtp; bh=Tn6KWgM4dZT4sz5AMhRuVHOO83c=; b=cory ZDIQ9DhwnKDxo3hYx4nJ0OU9xH/XHbyF2OoRlTCa4Ev0JggylxLTGxUsvekH5HIO Ubp0MnXJjkxzcyAPizXAxSbDGByfCydUZgV1zkfyMJo0mpGCNLpTIa1mox197LTA eBrXndKB89DvP7Usf+Fu2NMof7bsFzjIdDdaAbY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:subject:date :message-id:mime-version:content-type; s=smtpout; bh=Tn6KWgM4dZT 4sz5AMhRuVHOO83c=; b=YeP3FcAaZ3LBghlI0BfTBNI0XPgSGaviwOhlZfRNEZw NAcDD+GfYm652HIhn78DnPc5n+h5FQGFUIR3NGoqEqJ8IgzeD5ppRAyW+LK8PB9o dxN0zd1lYiHS2kbk3NgFiJFoeTKTZQkqGT5W8hNs5fhpQ90WC3LhZRywDjFgUXt0 = X-Sasl-enc: ET6uCK8+XzH1cxPUF16lwKSRcVvWt2QihXCSPoWE5MkD 1413153356 Original-Received: from shorty.local (unknown [23.243.192.221]) by mail.messagingengine.com (Postfix) with ESMTPA id 72C32C00014 for ; Sun, 12 Oct 2014 18:35:56 -0400 (EDT) Original-Received: from ip6-localhost ([::1] helo=shorty.local) by shorty.local with esmtp (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1XdRk3-0006ek-91 for bug-gnu-emacs@gnu.org; Sun, 12 Oct 2014 15:35:55 -0700 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:94447 --=-=-= Content-Type: text/plain Hi. Attached is a small feature patch. Currently when a hi-lock.el function is called interactively, the default offered by (read-regexp) is the last value. With the patch, the behavior is the same if no active region is available; if an active region IS available, the default is the contents of the region. Perhaps something like this should be added to (read-regexp), but that's a bigger proposal than this small patch. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-hi-lock-interactive-functions-now-default-to-the-act.patch >From ccf892b48f8bb93c6352f611b4256cb401222668 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 12 Oct 2014 15:32:02 -0700 Subject: [PATCH] hi-lock interactive functions now default to the active region, if there is one --- lisp/hi-lock.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 98a26dd..6b06d08 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -419,7 +419,10 @@ highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight line" 'regexp-history-last)) + (read-regexp "Regexp to highlight line" + (if mark-active + (buffer-substring-no-properties (point) (mark)) + 'regexp-history-last))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -443,7 +446,10 @@ highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight" 'regexp-history-last)) + (read-regexp "Regexp to highlight" + (if mark-active + (buffer-substring-no-properties (point) (mark)) + 'regexp-history-last))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -468,7 +474,10 @@ highlighting will not update as you type." (list (hi-lock-regexp-okay (hi-lock-process-phrase - (read-regexp "Phrase to highlight" 'regexp-history-last))) + (read-regexp "Phrase to highlight" + (if mark-active + (buffer-substring-no-properties (point) (mark)) + 'regexp-history-last)))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) -- 2.0.0 --=-=-=--