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


View this message in rfc822 format

From: Drew Adams <drew.adams <at> oracle.com>
To: Ed Avis <eda <at> waniasset.com>, 20723 <at> debbugs.gnu.org
Subject: bug#20723: 24.4; narrow-to-line
Date: Tue, 2 Jun 2015 11:14:54 -0700 (PDT)
> 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))))

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

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




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.