GNU bug report logs - #20723
24.4; narrow-to-line

Previous Next

Package: emacs;

Reported by: Ed Avis <eda <at> waniasset.com>

Date: Tue, 2 Jun 2015 17:01:03 UTC

Severity: wishlist

Tags: wontfix

Found in version 24.4

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Kangas <stefan <at> marxist.se>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 20723 <at> debbugs.gnu.org, Ed Avis <eda <at> waniasset.com>
Subject: Re: bug#20723: 24.4; narrow-to-line
Date: Wed, 06 Nov 2019 03:05:17 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

>> It would be handy to have M-x narrow-to-line to narrow the buffer to
>> the line point is currently on.
>
> (defun narrow-to-line (&optional arg)
>   "Narrow to the text of the current line.
> A numeric prefix arg means move forward (backward if negative) that
> many lines, thus narrowing to a line other than the one point was
> originally in."
>   (interactive "P")
>   (setq arg  (if arg (prefix-numeric-value arg) 0))
>   (let ((inhibit-field-motion  t))
>     (save-excursion
>       (forward-line arg)
>       (narrow-to-region (line-beginning-position) (line-end-position)))))
>
> (defun mark-line (&optional arg)
>   "Put mark at end of line, point at beginning.
> A numeric prefix arg means move forward (backward if negative) that
> many lines, thus marking a line other than the one point was
> originally in."
>   (interactive "P")
>   (setq arg  (if arg (prefix-numeric-value arg) 0))
>   (let ((inhibit-field-motion  t))
>     (forward-line arg)
>     (push-mark nil t t)
>     (goto-char (line-end-position))))

I think the proposal to add these commands make sense, since there
seems to exist a user demand.  Would anyone object to including the
above commands in Emacs?

> The problem is what keys, if any, to bind them to by default.

I'd suggest that we bind narrow-to-line to 'C-x n l', and leave
mark-line unbound by default for now.

> Here are some existing commands that are similar:
> http://www.gnu.org/software/emacs/manual/html_node/emacs/Narrowing.html
> http://www.gnu.org/software/emacs/manual/html_node/emacs/Marking-Objects.html

Best regards,
Stefan Kangas




This bug report was last modified 3 years and 116 days ago.

Previous Next


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