sheijk / hideshowvis Goto Github PK
View Code? Open in Web Editor NEWAdd little +/- icons in the Emacs fringe for regions which hideshow.el can hide.
License: GNU General Public License v2.0
Add little +/- icons in the Emacs fringe for regions which hideshow.el can hide.
License: GNU General Public License v2.0
Since 2015 there were talks in MELPA about depreciating all 'emacswiki' packages because "anyone can edit your package(s) on the Emacswiki and that poses a security risk".
Finally on 24 Jan, @milkipostman "inadvertently deleted all emacswiki packages", which was probably a good thing.
The problem is that I'm very fond of 'hideshowvis', and I have an automated emacs install that is failing because hideshowvis can't be found (obviously I'm installing it by hand).
Could you add this library to MELPA (or ELPA)?
Issue filed for both projects.
I couldn't find it anywhere until somebody showed me the lambda function to make it happen, so I figured I'd put it in the official git repo so that if somebody needs to find it, they don't need to dig through Reddit.
Put this in your init.el
file.
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
If you're using use-package
:config
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
The code in hideshowvis-symbols can be moved to the toplevel and the function will only update hs-set-up-overlay. Mostly testing needed
I'm using Emacs 27, but also tested with Emacs 26 and I can only see the -
markers for closed and opened folds. Doesn't depend on a major mode.
When I place the following code in my init.el file:
(autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions")
(autoload 'hideshowvis-minor-mode
"hideshowvis"
"Will indicate regions foldable with hideshow in the fringe."
'interactive)
(dolist (hook (list
'emacs-lisp-mode-hook
'json-mode-hook
'c++-mode-hook
'python-mode ;; doesn't work?
'perl-mode ;; doesn't work?
))
(add-hook hook 'hideshowvis-enable))
(hideshowvis-symbols)
I get the following error:
Symbol's function definition is void: hideshowvis-symbols
If I remove that line and run hideshowvis-symbols interactively, it works.
How come it doesn't work when run in init.el?
If I have hideshowvis-symbols enabled, and the regions are hidden and showing the yellow rectangle on the right, if I select a region (say, the whole buffer) and then press TAB (for indent-for-tab-command ) the code is changed, with parts of it removed (parentheses or even complete expressions).
This is code to show the problem:
emacs -Q
and evaluate this code:(add-hook 'prog-mode-hook 'hs-minor-mode)
(add-to-list 'load-path "wherever-hideshowsivis-is")
(require 'hideshowvis)
(add-hook 'emacs-lisp-mode-hook 'hideshowvis-enable)
;; the next line is the culprit
(add-hook 'emacs-lisp-mode-hook 'hideshowvis-symbols)
Now, in that same emacs, open a file like, for example, this one:
(defun a ()
(setq b 93))
(defun a2 ()
(setq b 93
))
Now, in the file hs-hide-all
. It will show this:
Then, mark the whole buffer and press TAB (or M-x indent-region
). And notice the modeline shows the buffer has been changed (indent-region could do that, but it should not have changed anything in this buffer)
In fact, this is how the code looks if we hs-show-all
:
In the first block, (setq b 93)
has been erased and in the second block one closing parenthesis has been erased.
If we do not enable hideshow-symbols
none of this happens, as far as I can tell.
EDIT: a simple, though brutal and ugly, way of dealing with this for now is advicing indent-region
:
(advice-add 'indent-region :before (lambda (&rest args) (hs-show-all)))
I do not know if there is a better way.
This is a question, not a bug.
I'd like to have, for comments, a similar visual indication as that provided by hideshowvis-symbols
. As far as I can tell, this is not customizable, and I guess I'd need to modify the function hideshowvis-symbols
, starting on the line with (when (eq 'code (overlay-get ov 'hs))
. The display of the number of lines hidden is not the most important; it is the visual indicator that stuff is hidden. Any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.