fold anything
authorJoerg Jaspert <joerg.jaspert.sp@dlh.de>
Fri, 28 Dec 2018 12:08:06 +0000 (13:08 +0100)
committerJoerg Jaspert <joerg.jaspert.sp@dlh.de>
Wed, 3 Apr 2019 14:07:56 +0000 (16:07 +0200)
.emacs.d/config/emacs.org

index 701636b..867b954 100644 (file)
@@ -1089,6 +1089,21 @@ Now I want the buffers of it appear in sh-mode by default
       save-interprogram-paste-before-kill t)
 
 #+END_SRC
+*** Fold anything more indented than current line
+[2018-02-14 Mi 12:39]
+Taken from [[https://stackoverflow.com/questions/1587972/how-to-display-indentation-guides-in-emacs/4459159#4459159][stackoverflow]]
+#+BEGIN_SRC emacs-lisp
+(defun aj-toggle-fold ()
+  "Toggle fold all lines larger than indentation on current line"
+  (interactive)
+  (let ((col 1))
+    (save-excursion
+      (back-to-indentation)
+      (setq col (+ 1 (current-column)))
+      (set-selective-display
+       (if selective-display nil (or col 1))))))
+;(bind-key "C-i" 'aj-toggle-fold)
+#+END_SRC
 * Customized variables
 [2013-05-02 Thu 22:14]
 The following contains a set of variables i may reasonably want to