* nxml-mode does not remove its overlays
@ 2008-03-08 19:22 Lennart Borgman (gmail)
2008-03-08 21:02 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-08 19:22 UTC (permalink / raw)
To: Emacs Devel
Could this be added to nxml.el?
;; This should be run in `change-major-mode-hook'."
;; Should be part of nxml.el IMO
(defun nxml-change-mode ()
;; Remove overlays used by nxml-mode.
(save-excursion
(unless (and (= (point-min) 1)
(= (point-max) (1+ (buffer-size))))
(widen))
(rng-validate-mode 0)
(let ((inhibit-read-only t)
(buffer-undo-list t)
(modified (buffer-modified-p)))
(nxml-with-invisible-motion
(remove-text-properties (point-min) (point-max) '(face nil)))
(set-buffer-modified-p modified))))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nxml-mode does not remove its overlays
2008-03-08 19:22 nxml-mode does not remove its overlays Lennart Borgman (gmail)
@ 2008-03-08 21:02 ` Stefan Monnier
2008-03-09 2:40 ` Bastien
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-03-08 21:02 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Devel
> (unless (and (= (point-min) 1)
> (= (point-max) (1+ (buffer-size))))
> (widen))
Please just use `widen'. It's not like it's expensive of anything.
Stefan
PS: To check if a buffer is widened, please use
(= (buffer-size) (- (point-max) (point-min)))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nxml-mode does not remove its overlays
2008-03-08 21:02 ` Stefan Monnier
@ 2008-03-09 2:40 ` Bastien
2008-03-09 10:18 ` David Kastrup
0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2008-03-09 2:40 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Lennart Borgman (gmail), Emacs Devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> PS: To check if a buffer is widened, please use
> (= (buffer-size) (- (point-max) (point-min)))
This is something I've already been looking for several times.
Maybe this could go in simple.el:
(defun buffer-narrowed-p
"Return non-nil if the current buffer is narrowed."
(not (= (buffer-size)
(- (point-max)
(point-min)))
--
Bastien
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nxml-mode does not remove its overlays
2008-03-09 2:40 ` Bastien
@ 2008-03-09 10:18 ` David Kastrup
0 siblings, 0 replies; 4+ messages in thread
From: David Kastrup @ 2008-03-09 10:18 UTC (permalink / raw)
To: Bastien; +Cc: Lennart Borgman (gmail), Stefan Monnier, Emacs Devel
Bastien <bzg@altern.org> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> PS: To check if a buffer is widened, please use
>> (= (buffer-size) (- (point-max) (point-min)))
>
> This is something I've already been looking for several times.
>
> Maybe this could go in simple.el:
>
> (defun buffer-narrowed-p
> "Return non-nil if the current buffer is narrowed."
> (not (= (buffer-size)
> (- (point-max)
> (point-min)))
Use /= rather than (not (= ... and a defsubst. Of course, a defsubst
means that people are not free to change the buffer-size/point-min/max
semantics/invariants without having to recompile everything.
But I think I rather prefer if people have to work hard for a different
scenario...
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-09 10:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-08 19:22 nxml-mode does not remove its overlays Lennart Borgman (gmail)
2008-03-08 21:02 ` Stefan Monnier
2008-03-09 2:40 ` Bastien
2008-03-09 10:18 ` David Kastrup
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.