GNU bug report logs - #434
Minor Enhancement: Toggle narrowing/widen a function region and all

Previous Next

Package: emacs;

Reported by: Kazuo YAGI <kyagi <at> miraclelinux.com>

Date: Tue, 17 Jun 2008 06:00:03 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 434 in the body.
You can then email your comments to 434 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#434; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Kazuo YAGI <kyagi <at> miraclelinux.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Kazuo YAGI <kyagi <at> miraclelinux.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Minor Enhancement: Toggle narrowing/widen a function region and all
Date: Tue, 17 Jun 2008 14:53:18 +0900
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))))






Tags added: patch Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Tue, 01 Jul 2008 07:15:03 GMT) Full text and rfc822 format available.

Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 10 Sep 2008 01:25:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#434; Package emacs. (Wed, 11 Apr 2012 12:14:02 GMT) Full text and rfc822 format available.

Message #12 received at 434 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Kazuo YAGI <kyagi <at> miraclelinux.com>
Cc: 434 <at> debbugs.gnu.org
Subject: Re: bug#434: Minor Enhancement: Toggle narrowing/widen a function
	region and all
Date: Wed, 11 Apr 2012 14:12:32 +0200
Kazuo YAGI <kyagi <at> miraclelinux.com> writes:

> 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.

I think it's an interesting idea.  Narrowing to the current function to
search around in it (especially when refactoring) is something that I
often do "manually", so having a handy keystroke for it would be nice, I
think.

`C-x n f', for instance, to toggle narrowing to the current function.

Opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#434; Package emacs. (Wed, 11 Apr 2012 17:57:02 GMT) Full text and rfc822 format available.

Message #15 received at 434 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Lars Magne Ingebrigtsen'" <larsi <at> gnus.org>,
	"'Kazuo YAGI'" <kyagi <at> miraclelinux.com>
Cc: 434 <at> debbugs.gnu.org
Subject: RE: bug#434: Minor Enhancement: Toggle narrowing/widen a function
	regionand all
Date: Wed, 11 Apr 2012 10:55:07 -0700
> Narrowing to the current function to search around in it
> (especially when refactoring) is something that I often do
> "manually", so having a handy keystroke for it would 
> be nice, I think.
> 
> `C-x n f', for instance, to toggle narrowing to the current function.
> 
> Opinions?

YAGNI.  `narrow-to-defun' is `C-x n d'.  We don't need a toggle for each
narrowing command.  And certainly not another key binding.

This is the kind of thing that any user can do, if desired.  There are lots of
commands that some users might want to bind.  It is trivial for a user to do so.
No need for Emacs to do this by default.  One opinion.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#434; Package emacs. (Thu, 12 Apr 2012 06:29:01 GMT) Full text and rfc822 format available.

Message #18 received at 434 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 434 <at> debbugs.gnu.org, 'Lars Magne Ingebrigtsen' <larsi <at> gnus.org>,
	'Kazuo YAGI' <kyagi <at> miraclelinux.com>
Subject: Re: bug#434: Minor Enhancement: Toggle narrowing/widen a function
	regionand all
Date: Thu, 12 Apr 2012 14:27:09 +0800
"Drew Adams" <drew.adams <at> oracle.com> writes:

>> Narrowing to the current function to search around in it (especially
>> when refactoring) is something that I often do "manually", so having
>> a handy keystroke for it would be nice, I think.
>> 
>> `C-x n f', for instance, to toggle narrowing to the current function.
>> 
>> Opinions?
>
> YAGNI.  `narrow-to-defun' is `C-x n d'.  We don't need a toggle for
> each narrowing command.  And certainly not another key binding.

Agreed.




Added tag(s) wontfix. Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 12 Apr 2012 06:30:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 434 <at> debbugs.gnu.org and Kazuo YAGI <kyagi <at> miraclelinux.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 12 Apr 2012 06:30:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#434; Package emacs. (Thu, 12 Apr 2012 12:30:02 GMT) Full text and rfc822 format available.

Message #25 received at 434 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 434 <at> debbugs.gnu.org, 'Kazuo YAGI' <kyagi <at> miraclelinux.com>
Subject: Re: bug#434: Minor Enhancement: Toggle narrowing/widen a function
	regionand all
Date: Thu, 12 Apr 2012 14:28:20 +0200
"Drew Adams" <drew.adams <at> oracle.com> writes:

> YAGNI.  `narrow-to-defun' is `C-x n d'. 

I didn't know about that command, which should be sufficient.  I'm
closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 11 May 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.