From cabb2ca61ee287a645aa4869f268f5b09db7a134 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 5 Jan 2021 11:53:41 -0600 Subject: Remove the Rasmus segment --- config.org | 90 +------------------------------------------------------------- 1 file changed, 1 insertion(+), 89 deletions(-) diff --git a/config.org b/config.org index 2b83bc7..a239658 100644 --- a/config.org +++ b/config.org @@ -1046,99 +1046,11 @@ For right now, I’m /just/ using Anzu – I don’t like parts of =isearch= but ** Prettify symbols -*** A bit from Rasmus - - from [[https://pank.eu/blog/pretty-babel-src-blocks.html#coderef-symbol][Rasmus Roulund]], via [[https://alhassy.github.io/emacs.d/index.html#Making-Block-Delimiters-Less-Intrusive][Musa Al-hassy]]. - - #+begin_src emacs-lisp - (defvar-local rasmus/org-at-src-begin -1 - "Variable that holds whether last position was a ") - - (defvar rasmus/ob-header-symbol ?☰ - "Symbol used for babel headers") - - (defun rasmus/org-prettify-src--update () - (let ((case-fold-search t) - (re "^[ \t]*#\\+begin_src[ \t]+[^ \f\t\n\r\v]+[ \t]*") - found) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward re nil t) - (goto-char (match-end 0)) - (let ((args (org-trim - (buffer-substring-no-properties (point) - (line-end-position))))) - (when (org-string-nw-p args) - (let ((new-cell (cons args rasmus/ob-header-symbol))) - (cl-pushnew new-cell prettify-symbols-alist :test #'equal) - (cl-pushnew new-cell found :test #'equal))))) - (setq prettify-symbols-alist - (cl-set-difference prettify-symbols-alist - (cl-set-difference - (cl-remove-if-not - (lambda (elm) - (eq (cdr elm) rasmus/ob-header-symbol)) - prettify-symbols-alist) - found :test #'equal))) - ;; Clean up old font-lock-keywords. - (font-lock-remove-keywords nil prettify-symbols--keywords) - (setq prettify-symbols--keywords (prettify-symbols--make-keywords)) - (font-lock-add-keywords nil prettify-symbols--keywords) - (while (re-search-forward re nil t) - (font-lock-flush (line-beginning-position) (line-end-position)))))) - - (defun rasmus/org-prettify-src () - "Hide src options via `prettify-symbols-mode'. - - `prettify-symbols-mode' is used because it has uncollpasing. It's - may not be efficient." - (let* ((case-fold-search t) - (at-src-block (save-excursion - (beginning-of-line) - (looking-at "^[ \t]*#\\+begin_src[ \t]+[^ \f\t\n\r\v]+[ \t]*")))) - ;; Test if we moved out of a block. - (when (or (and rasmus/org-at-src-begin - (not at-src-block)) - ;; File was just opened. - (eq rasmus/org-at-src-begin -1)) - (rasmus/org-prettify-src--update)) - ;; Remove composition if at line; doesn't work properly. - ;; (when at-src-block - ;; (with-silent-modifications - ;; (remove-text-properties (match-end 0) - ;; (1+ (line-end-position)) - ;; '(composition)))) - (setq rasmus/org-at-src-begin at-src-block))) - - (defun rasmus/org-prettify-symbols () - (mapc (apply-partially 'add-to-list 'prettify-symbols-alist) - (cl-reduce 'append - (mapcar (lambda (x) (list x (cons (upcase (car x)) (cdr x)))) - `(("#+begin_src" . ?✎) ;; ➤ 🖝 ➟ ➤ ✎ - ("#+end_src" . ?⏹) ;; □ - ("#+header:" . ,rasmus/ob-header-symbol) - ("#+begin_quote" . ?») - ("#+end_quote" . ?«))))) - (turn-on-prettify-symbols-mode) - (add-hook 'post-command-hook 'rasmus/org-prettify-src t t)) - #+end_src - -*** Regular prettify-symbols-mode - #+begin_src emacs-lisp (cuss prettify-symbols-unprettify-at-point 'right-edge "Unprettify a symbol when inside it or next to it.") - (defun acdw/org-mode-prettify () - "Prettify `org-mode'." - (append '(("[ ]" . ?□) ("[X]" . ?☑) ("[-]" . ?◐) - ("#begin_src" . ?🖬) ("#BEGIN_SRC" . ?🖬) - ("#end_src" . ?■) ("#END_SRC" . ?■)) - prettify-symbols-alist)) - - (add-hook 'org-mode-hook #'acdw/org-mode-prettify) - - (global-prettify-symbols-mode +1) + (add-hook 'prog-mode-hook #'prettify-symbols-mode) #+end_src ** Parentheses -- cgit 1.4.1-21-gabe81