[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
avoid narrow-to-region (was: Re: replace-regexp)
From: |
Emanuel Berg |
Subject: |
avoid narrow-to-region (was: Re: replace-regexp) |
Date: |
Sun, 09 May 2021 00:59:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier via Users list for the GNU Emacs text editor wrote:
> I recommend avoiding the use of narrowing as much as
> possible since it can have other undesirable effects (e.g.
> it changes the result of things like `syntax-ppss`).
I checked my Elisp for `narrow-to-region' and found just one
use, namely
(defun sort-lines-random (beg end)
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(sort-subr nil
#'forward-line
#'end-of-line
nil nil
(lambda (_ __) (zerop (random 2)) )))))
(defalias 'r #'sort-lines-random)
;; test here:
;; aaa
;; ccc
;; ddd
;; bbb
If one were to remove it, how would one specify the end of
the operation?
https://dataswamp.org/~incal/emacs-init/sort-incal.el
--
underground experts united
https://dataswamp.org/~incal
- RE: [External] : Re: replace-regexp, (continued)
- RE: [External] : Re: replace-regexp, Drew Adams, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Stefan Monnier, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/08
- Re: replace-regexp, Emanuel Berg, 2021/05/09
- avoid narrow-to-region (was: Re: replace-regexp),
Emanuel Berg <=
- Re: avoid narrow-to-region (was: Re: replace-regexp), Yuri Khan, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Emanuel Berg, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Yuri Khan, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Emanuel Berg, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Jean Louis, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Emanuel Berg, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Yuri Khan, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Emanuel Berg, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Yuri Khan, 2021/05/09
- Re: avoid narrow-to-region (was: Re: replace-regexp), Emanuel Berg, 2021/05/09