* hide-region package and cperl
@ 2006-03-22 13:44 rahed
0 siblings, 0 replies; 7+ messages in thread
From: rahed @ 2006-03-22 13:44 UTC (permalink / raw)
Hi,
when applying M-x hide-region-hide on a text in cperl-mode, I can see
@[]@ tags arround the region, but the text remains visible.
emacs-version is 21.3.1
The function is ok with 22.0.50.1.
Does anyone know the cause?
Thank you.
--
Radek
^ permalink raw reply [flat|nested] 7+ messages in thread
* hide-region package and cperl
@ 2006-03-22 20:37 rahed
2006-03-23 12:09 ` Mathias Dahl
2006-03-29 5:18 ` Stefan Monnier
0 siblings, 2 replies; 7+ messages in thread
From: rahed @ 2006-03-22 20:37 UTC (permalink / raw)
Hi,
when applying M-x hide-region-hide on a text in cperl-mode, I can see
@[]@ tags arround the region, but the text remains visible.
emacs-version is 21.3.1
The function is ok with 22.0.50.1.
Does anyone know the cause?
Thank you.
--
Radek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hide-region package and cperl
2006-03-22 20:37 hide-region package and cperl rahed
@ 2006-03-23 12:09 ` Mathias Dahl
2006-03-23 12:59 ` rahed
[not found] ` <mailman.6.1143119835.9694.help-gnu-emacs@gnu.org>
2006-03-29 5:18 ` Stefan Monnier
1 sibling, 2 replies; 7+ messages in thread
From: Mathias Dahl @ 2006-03-23 12:09 UTC (permalink / raw)
rahed <rahed@e-last-minute.com> writes:
> when applying M-x hide-region-hide on a text in cperl-mode, I can see
> @[]@ tags arround the region, but the text remains visible.
> emacs-version is 21.3.1
> The function is ok with 22.0.50.1.
Does it work in other modes (fundamental-mode, or text-mode, for
example) in Emacs 21.3.1?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hide-region package and cperl
2006-03-23 12:09 ` Mathias Dahl
@ 2006-03-23 12:59 ` rahed
[not found] ` <mailman.6.1143119835.9694.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 7+ messages in thread
From: rahed @ 2006-03-23 12:59 UTC (permalink / raw)
Mathias Dahl <brakjoller@gmail.com> writes:
> Does it work in other modes (fundamental-mode, or text-mode, for
> example) in Emacs 21.3.1?
Yes, it does.
--
Radek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hide-region package and cperl
[not found] ` <mailman.6.1143119835.9694.help-gnu-emacs@gnu.org>
@ 2006-03-27 9:50 ` Mathias Dahl
0 siblings, 0 replies; 7+ messages in thread
From: Mathias Dahl @ 2006-03-27 9:50 UTC (permalink / raw)
rahed <rahed@e-last-minute.com> writes:
>> Does it work in other modes (fundamental-mode, or text-mode, for
>> example) in Emacs 21.3.1?
Then `cperl-mode' and `hide-region' has problems with each other. I do
not use `cperl-mode' so I would not know what might be the
problem. Maybe it overrides "stuff"? :)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hide-region package and cperl
2006-03-22 20:37 hide-region package and cperl rahed
2006-03-23 12:09 ` Mathias Dahl
@ 2006-03-29 5:18 ` Stefan Monnier
2006-03-30 6:24 ` Mathias Dahl
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2006-03-29 5:18 UTC (permalink / raw)
> when applying M-x hide-region-hide on a text in cperl-mode, I can see
> @[]@ tags arround the region, but the text remains visible.
> emacs-version is 21.3.1
> The function is ok with 22.0.50.1.
> Does anyone know the cause?
Yes: it uses the t value for its `invisible' property, but doesn't add it to
the buffer's invisibility spec. As long as the invisibility spec is not
changed by any other major or minor mode, it works, but in general
it's incorrect.
Also I'd advise the package author not to use the `intangible' property,
since it tends to break other packages when they bump into it.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: hide-region package and cperl
2006-03-29 5:18 ` Stefan Monnier
@ 2006-03-30 6:24 ` Mathias Dahl
0 siblings, 0 replies; 7+ messages in thread
From: Mathias Dahl @ 2006-03-30 6:24 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> when applying M-x hide-region-hide on a text in cperl-mode, I can see
>> @[]@ tags arround the region, but the text remains visible.
>> emacs-version is 21.3.1
>> The function is ok with 22.0.50.1.
>
>> Does anyone know the cause?
>
> Yes: it uses the t value for its `invisible' property, but doesn't add it to
> the buffer's invisibility spec. As long as the invisibility spec is not
> changed by any other major or minor mode, it works, but in general
> it's incorrect.
>
> Also I'd advise the package author not to use the `intangible' property,
> since it tends to break other packages when they bump into it.
>
>
> Stefan
Thanks for the input, Stefan. I read in the Emacs Lisp Manual about
how to handle this. Hopefully I do the right thing now. I also added a
toggle between using ellipsis or the user-defined markers as markers
for the hidden regions. Now the source also complies with what
`checkdoc' likes. I'd appreciate comments on the part of the code that
handles the invisible property:
;;; hide-region.el --- hide regions of text using overlays
;;
;; Copyright (C) 2001, 2005, 2006 Mathias Dahl
;;
;; Version: 1.0.2
;; Keywords: hide, region
;; Author: Mathias Dahl <mathias.rem0veth1s.dahl@gmail.com>
;; Maintainer: Mathias Dahl
;; URL: http://www.emacswiki.org
;;
;; This file is not part of GNU Emacs.
;;
;; This is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
;; License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;; Commentary:
;;
;; The function `hide-region-hide' hides the region. You can hide many
;; different regions and they will be "marked" by two configurable
;; strings (so that you know where the hidden text is).
;;
;; The hidden regions is pushed on a kind of hide-region \"ring\".
;;
;; The function `hide-region-unhide' "unhides" one region, starting
;; with the last one you hid.
;;
;;; Bugs
;;
;; Probably many, but none that I know of. Comments and suggestions
;; are welcome!
;;
;;; History:
;;
;; Version 1.0.1
;;
;; * Seems that the getting-stuck problem have disappeared since Emacs
;; 21.3 was released, so no need anymore for the extra movement
;; commands.
;;
;; * Added the intangible property to the overlays because that seemed
;; to remove a minor getting-stuck problem (the overlay "ate" one
;; keystroke) when navigating around an overlay. Adding the intangible
;; property makes it impossible to navigate into the overlay.
;;
;; * Added custom option to propertize the overlay markers for greater
;; visibility.
;;
;; * Minor code cleanup
;;
;; Version 1.0.2
;;
;; * Removed the `intangible' property as suggested by Stefan Monnier.
;;
;; * Tried to do the right thing regarding the `invisible' property
;; and `buffer-invisibility-spec'. Let's see how it works. Also
;; suggested by Stefan.
;;; Code:
(defgroup hide-region nil
"Functions to hide region using an overlay with the invisible
property. The text is not affected."
:prefix "hide-region-"
:group 'convenience)
(defcustom hide-region-before-string "@["
"String to mark the beginning of an invisible region.
This string is not really placed in the text, it is just shown in the overlay"
:type '(string)
:group 'hide-region)
(defcustom hide-region-after-string "]@"
"String to mark the beginning of an invisible region.
This string is not really placed in the text, it is just shown in
the overlay"
:type '(string)
:group 'hide-region)
(defcustom hide-region-use-marker-string t
"Toggles between using ellipsis or user-defined marker.
If non-nil, use the user-defined marker strings
`hide-region-before-string' and `hide-region-after-string'. If
nil, use ellipsis instead."
:type '(boolean)
:group 'hide-region)
(defcustom hide-region-propertize-markers t
"If non-nil, add text properties to the region markers."
:type 'boolean
:group 'hide-region)
(defvar hide-region-overlays nil
"Variable to store the regions we put an overlay on.")
(defun hide-region-hide ()
"Hides a region.
Hides a region by making an invisible overlay over it and save
the overlay on the `hide-region-overlays' \"ring\""
(interactive)
;; Use ellipsis instead of user-defined markers
(if hide-region-use-marker-string
(add-to-invisibility-spec 'hide-region)
(add-to-invisibility-spec '(hide-region . t)))
(let ((new-overlay (make-overlay (mark) (point))))
(setq hide-region-overlays
(append
(list new-overlay) hide-region-overlays))
(overlay-put new-overlay 'invisible 'hide-region)
;; Add user-defined markers
(when hide-region-use-marker-string
(overlay-put new-overlay 'before-string
(if hide-region-propertize-markers
(propertize hide-region-before-string
'font-lock-face 'region)
hide-region-before-string))
(overlay-put new-overlay 'after-string
(if hide-region-propertize-markers
(propertize hide-region-after-string
'font-lock-face 'region)
hide-region-after-string)))))
(defun hide-region-unhide ()
"Unhide a region.
Unhide one region at a time, starting with the last one hidden
and deleting the overlay from the `hide-region-overlays' \"ring\"."
(interactive)
(if (car hide-region-overlays)
(progn
(delete-overlay (car hide-region-overlays))
(setq hide-region-overlays (cdr hide-region-overlays)))))
(provide 'hide-region)
;;; hide-region.el ends here
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-03-30 6:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-22 20:37 hide-region package and cperl rahed
2006-03-23 12:09 ` Mathias Dahl
2006-03-23 12:59 ` rahed
[not found] ` <mailman.6.1143119835.9694.help-gnu-emacs@gnu.org>
2006-03-27 9:50 ` Mathias Dahl
2006-03-29 5:18 ` Stefan Monnier
2006-03-30 6:24 ` Mathias Dahl
-- strict thread matches above, loose matches on Subject: below --
2006-03-22 13:44 rahed
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.