There is this well-known package hide-region Link to the package (hide-region.el) I want to apply hide-region-hide from a certain "point a" to "point b" [a region] in my file. How can I do this? What I need to define? It works when I highlight manually some text, but I need to do it in my code and give it the beg. of a region and end of region and apply it to the resulted region.
Asked
Active
Viewed 88 times
1 Answers
2
The package is somewhat poorly written, and does not allow you to pass it a region as arguments to the function. You can probably work around this by something like
(save-excursion
(let (deactivate-mark) ; see save-excursion docs for why
(set-mark point-a) ; beginning of region you want to hide
(goto-char point-b) ; end of region you want to hide
(hide-region-hide) ) )
It would be better if hide-region-hide
took the region as arguments when called noninteractively, though. Perhaps the maintainer would be happy to accept a patch for this. See also the documentation for set-mark
which specifically advises against using it like I have done above. Furthermore, perhaps you also want to look at the documentation for save-excursion
.

tripleee
- 175,061
- 34
- 275
- 318
-
Didn't see this until I had already answered that question. Please don't spam around. – tripleee Sep 04 '12 at 09:57