From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kazuo YAGI Newsgroups: gmane.emacs.bugs Subject: bug#434: Minor Enhancement: Toggle narrowing/widen a function region and all Date: Tue, 17 Jun 2008 14:53:18 +0900 Message-ID: <4857514E.60204@miraclelinux.com> Reply-To: Kazuo YAGI , 434@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1213682850 2004 80.91.229.12 (17 Jun 2008 06:07:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Jun 2008 06:07:30 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 17 08:08:14 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K8UMX-00036y-P1 for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jun 2008 08:08:14 +0200 Original-Received: from localhost ([127.0.0.1]:34876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K8ULj-0005Br-Fs for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jun 2008 02:07:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K8ULe-0005Bl-Lo for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 02:07:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K8ULd-0005BZ-02 for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 02:07:18 -0400 Original-Received: from [199.232.76.173] (port=35408 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K8ULc-0005BW-TK for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 02:07:16 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:41629) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K8ULc-00061D-Fq for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 02:07:16 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5H678EK023305; Mon, 16 Jun 2008 23:07:09 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m5H603Ln020295; Mon, 16 Jun 2008 23:00:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Kazuo YAGI Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 17 Jun 2008 06:00:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 434 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.121368208419082 (code B ref -1); Tue, 17 Jun 2008 06:00:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 17 Jun 2008 05:54:44 +0000 Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5H5sZZ7019076 for ; Mon, 16 Jun 2008 22:54:37 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K8U9L-0004Mh-Dy for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 01:54:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K8U9J-0004L4-2w for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 01:54:33 -0400 Original-Received: from [199.232.76.173] (port=45415 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K8U9I-0004Ko-HK for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 01:54:32 -0400 Original-Received: from ns.miraclelinux.com ([219.118.163.66]:43006 helo=mail.miraclelinux.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K8U9I-0003qh-0I for bug-gnu-emacs@gnu.org; Tue, 17 Jun 2008 01:54:32 -0400 Original-Received: from mail.miraclelinux.com (mail.miraclelinux.com [127.0.0.1]) by localhost (Postfix) with SMTP id 2933972197 for ; Tue, 17 Jun 2008 14:54:27 +0900 (JST) Original-Received: from dhcp-0225.miraclelinux.com (dhcp-0225.miraclelinux.com [10.1.1.225]) by mail.miraclelinux.com (Postfix) with ESMTP id 016A572194 for ; Tue, 17 Jun 2008 14:54:26 +0900 (JST) User-Agent: Thunderbird 2.0.0.12 (X11/20080227) X-Enigmail-Version: 0.95.0 X-PMX-Version: 5.3.1.294258, Antispam-Engine: 2.5.1.298604, Antispam-Data: 2008.6.17.53950 X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Tue, 17 Jun 2008 02:07:18 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:18433 Archived-At: I'd like to suggest a minor enhancement below. This is to let you toggle narrowing/widen a function region and all when editing a source code. This works with C-s, M-%. M-x replace-string, M-x occur, etc ... I think it make us easy to search/replace a word within a function. And it is for not to jump over a function if you want to edit it only. If you will, would you comment about this minor enhancement and tell me which *.el is suitable for adding it? Thanks for reading, - Kazuo ;;; In GNU Emacs 22.1.1 (i686-pc-linux-gnu) ;;; of 2008-05-09 on milia ;;; Windowing system distributor `The X.Org Foundation', version 11.0.10400090 ;;; This is to let you toggle narrowing/widen a function region and all ;;; when editing a source code. (defvar toggle-narrowing-function-and-all-p nil) (defun toggle-narrowing-function-and-all () (setq toggle-narrowing-function-and-all-p (not toggle-narrowing-function-and-all-p))) (defun toggle-narrowing-function () (interactive) (toggle-narrowing-function-and-all) (save-excursion (if toggle-narrowing-function-and-all-p (progn (next-line) (beginning-of-defun) (let ((beg)(end)) (setq beg (point)) (end-of-defun) (setq end (point)) (narrow-to-region beg end) (count-lines-region beg end))) (widen))))