all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kazuo YAGI <kyagi@miraclelinux.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#434: Minor Enhancement: Toggle narrowing/widen a function region and all
Date: Tue, 17 Jun 2008 14:53:18 +0900	[thread overview]
Message-ID: <4857514E.60204@miraclelinux.com> (raw)

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








             reply	other threads:[~2008-06-17  5:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17  5:53 Kazuo YAGI [this message]
2012-04-11 12:12 ` bug#434: Minor Enhancement: Toggle narrowing/widen a function region and all Lars Magne Ingebrigtsen
2012-04-11 17:55   ` bug#434: Minor Enhancement: Toggle narrowing/widen a function regionand all Drew Adams
2012-04-12  6:27     ` Chong Yidong
2012-04-12 12:28     ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4857514E.60204@miraclelinux.com \
    --to=kyagi@miraclelinux.com \
    --cc=434@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.