[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20723: 24.4; narrow-to-line
From: |
Stefan Kangas |
Subject: |
bug#20723: 24.4; narrow-to-line |
Date: |
Wed, 06 Nov 2019 03:05:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Drew Adams <drew.adams@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
- bug#20723: 24.4; narrow-to-line,
Stefan Kangas <=