;;; hide-string.el --- hide long strings with hide-region+ ;;; Corwin Brust ;;; Commentary: ;;; hide-region+ from: https://www.emacswiki.org/emacs/download/hide-region%2b ;;; Code: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; IT WORKS!!! (defcustom hqs-min-length 79 "Quoted strings less than this length are not hidden. Set to 0 to hide strings of any length." :type 'number :group 'hide-quoted-string) (defcustom hqs-min-lines 3 "A quoted string is not hidden unless it spans at least this many lines." :type 'number :group 'hide-quoted-string) (defun hqs-hide-long-strings () "Hide \"quoted\" strings using hide-regions+." (interactive) (save-excursion (unwind-protect (progn (goto-char (point-min)) (while (re-search-forward "\[^\\\]\"" nil t) (set-mark (point)) (when (and (re-search-forward "\[^\\\]\"" nil t) (or (= 0 hqs-min-lines) (< hqs-min-lines (count-lines (mark) (point)))) (or (= 0 hqs-min-length) (< hqs-min-length (- (point) (mark))))) (backward-char) (hide-region-hide) ))) (set-mark nil)))) (provide 'hide-string) ;;; hide-string.el ends here