Remove my settings in favor of org-modern
And try to get some of the svg-tags working as I would like.
This commit is contained in:
		
							parent
							
								
									0599164dec
								
							
						
					
					
						commit
						6237637f90
					
				
					 2 changed files with 53 additions and 121 deletions
				
			
		| 
						 | 
					@ -33,9 +33,18 @@ Since I use ellipsis in my writing… to /change/ how org renders a collapsed he
 | 
				
			||||||
  (setq org-pretty-entities t
 | 
					  (setq org-pretty-entities t
 | 
				
			||||||
        org-ellipsis "⤵"     ; …, ➡, ⚡, ▼, ↴, , ∞, ⬎, ⤷, ⤵
 | 
					        org-ellipsis "⤵"     ; …, ➡, ⚡, ▼, ↴, , ∞, ⬎, ⤷, ⤵
 | 
				
			||||||
        org-agenda-breadcrumbs-separator " ❱ "
 | 
					        org-agenda-breadcrumbs-separator " ❱ "
 | 
				
			||||||
        org-src-fontify-natively t ;; Pretty code blocks
 | 
					        org-catch-invisible-edits 'show-and-error
 | 
				
			||||||
 | 
					        org-special-ctrl-a/e t     ; Note: Need to get this working with Evil!
 | 
				
			||||||
 | 
					        org-src-fontify-natively t ; Pretty code blocks
 | 
				
			||||||
        org-hide-emphasis-markers t)
 | 
					        org-hide-emphasis-markers t)
 | 
				
			||||||
#+END_SRC
 | 
					#+END_SRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Oh, and as I indent lists, they should change the /bulleting/ in a particular sequence. If I begin with an =*= asterisk, I walk down the chain, but with the dashed bullets (my default choice), I just stay with dashed bullets. Numeric bullets should cycle:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#+BEGIN_SRC emacs-lisp
 | 
				
			||||||
 | 
					  (setq org-list-demote-modify-bullet '(("*" . "+") ("+" . "-") ("-" . "-")
 | 
				
			||||||
 | 
					                                        ("1." . "a.") ("a." . "1.")))
 | 
				
			||||||
 | 
					#+END_SRC
 | 
				
			||||||
** Typographic Quotes
 | 
					** Typographic Quotes
 | 
				
			||||||
According to [[http://endlessparentheses.com/prettify-your-quotation-marks.html][Artur Malabarba]] of [[http://endlessparentheses.com/prettify-you-apostrophes.html][Endless Parenthesis]] blog, I type a /straight quote/, ", Emacs actually inserts Unicode rounded quotes, like “this”. This idea isn’t how a file is /displayed/, but actually how the file is /made/. Time will tell if this idea works with my auxiliary functions on my phone, like [[https://play.google.com/store/apps/details?id=com.orgzly&hl=en_US&gl=US][Orgzly]] and [[https://github.com/amake/orgro][Orgro]].
 | 
					According to [[http://endlessparentheses.com/prettify-your-quotation-marks.html][Artur Malabarba]] of [[http://endlessparentheses.com/prettify-you-apostrophes.html][Endless Parenthesis]] blog, I type a /straight quote/, ", Emacs actually inserts Unicode rounded quotes, like “this”. This idea isn’t how a file is /displayed/, but actually how the file is /made/. Time will tell if this idea works with my auxiliary functions on my phone, like [[https://play.google.com/store/apps/details?id=com.orgzly&hl=en_US&gl=US][Orgzly]] and [[https://github.com/amake/orgro][Orgro]].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,87 +148,6 @@ This process allows us to use =variable-pitch= mode for all org documents.
 | 
				
			||||||
  (use-package org
 | 
					  (use-package org
 | 
				
			||||||
    :hook (org-mode . variable-pitch-mode))
 | 
					    :hook (org-mode . variable-pitch-mode))
 | 
				
			||||||
#+END_SRC
 | 
					#+END_SRC
 | 
				
			||||||
* Superstar
 | 
					 | 
				
			||||||
Now that headers are noticeable, I have no reason to see a number of asterisks. Once I used the [[https://github.com/sabof/org-bullets][org-bullets]] package, but believe we've replaced it with [[https://github.com/integral-dw/org-superstar-mode][org-superstar-mode]], so the following is an improvement, especially with the sub-bullets:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
  (use-package org-superstar
 | 
					 | 
				
			||||||
    :after org
 | 
					 | 
				
			||||||
    :straight (:type git :protocol ssh :host github :repo "integral-dw/org-superstar-mode")
 | 
					 | 
				
			||||||
    :hook (org-mode . org-superstar-mode)
 | 
					 | 
				
			||||||
    :init
 | 
					 | 
				
			||||||
    (setq ; org-superstar-headline-bullets-list '("▶")
 | 
					 | 
				
			||||||
          org-superstar-special-todo-items nil
 | 
					 | 
				
			||||||
          org-superstar-todo-bullet-alist t
 | 
					 | 
				
			||||||
          org-superstar-prettify-item-bullets t
 | 
					 | 
				
			||||||
          org-superstar-item-bullet-alist '((42 . "●")   ; *
 | 
					 | 
				
			||||||
                                            (43 . "○")   ; +
 | 
					 | 
				
			||||||
                                            (45 . "•"))))
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If this works, then we get the prettier bulleted list:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  * Top bullets
 | 
					 | 
				
			||||||
  * Plus bullets:
 | 
					 | 
				
			||||||
      + Apples
 | 
					 | 
				
			||||||
      + Oranges
 | 
					 | 
				
			||||||
      + Bananas
 | 
					 | 
				
			||||||
  * Minus bullets:
 | 
					 | 
				
			||||||
      - Dogs
 | 
					 | 
				
			||||||
      - Cats
 | 
					 | 
				
			||||||
      - Birds
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Oh, and as I indent lists, they should change the /bulleting/ in a particular sequence. If I begin with an =*= asterisk, I walk down the chain, but with the dashed bullets (my default choice), I just stay with dashed bullets. Numeric bullets should cycle:
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
  (setq org-list-demote-modify-bullet '(("*" . "+") ("+" . "-") ("-" . "-")
 | 
					 | 
				
			||||||
                                        ("1." . "a.") ("a." . "1.")))
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Since the following code does not work like I would have expected:
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp :tangle no
 | 
					 | 
				
			||||||
(setq org-hide-leading-stars t)
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
I add a hook to standard Org, and since this is a Lisp-2, I can get away with:
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp :tangle no
 | 
					 | 
				
			||||||
(defun org-hide-leading-stars ()
 | 
					 | 
				
			||||||
  (let* ((keyword
 | 
					 | 
				
			||||||
          `(("^\\(\\*+ \\)\\s-*\\S-" ; Do not hide empty headings!
 | 
					 | 
				
			||||||
             (1 (put-text-property (match-beginning 1) (match-end 1) 'invisible t)
 | 
					 | 
				
			||||||
                nil)))))
 | 
					 | 
				
			||||||
    (font-lock-add-keywords nil keyword)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  (add-hook 'org-mode-hook 'org-hide-leading-stars)
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
* Checkboxes
 | 
					 | 
				
			||||||
According to an idea by [[https://jft.home.blog/2019/07/17/use-unicode-symbol-to-display-org-mode-checkboxes/][Huy Trần]], we can prettify the list checkboxes as well:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
(defun ha-org-prettify-checkboxes ()
 | 
					 | 
				
			||||||
  "Beautify Org Checkbox Symbol"
 | 
					 | 
				
			||||||
  (push '("[ ]" . "☐") prettify-symbols-alist)
 | 
					 | 
				
			||||||
  (push '("[X]" . "☒") prettify-symbols-alist)
 | 
					 | 
				
			||||||
  (push '("[-]" . "☐-") prettify-symbols-alist)
 | 
					 | 
				
			||||||
  (prettify-symbols-mode))
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
And now we can attach it to a newly loaded org files:
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
(add-hook 'org-mode-hook 'ha-org-prettify-checkboxes)
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
To make it more distinguishable, he also changed the colors:
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
(defface org-checkbox-done-text
 | 
					 | 
				
			||||||
  '((t (:foreground "#71696A" :strike-through t)))
 | 
					 | 
				
			||||||
  "Face for the text part of a checked org-mode checkbox.")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(font-lock-add-keywords
 | 
					 | 
				
			||||||
 'org-mode
 | 
					 | 
				
			||||||
 `(("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
 | 
					 | 
				
			||||||
    1 'org-checkbox-done-text prepend))
 | 
					 | 
				
			||||||
 'append)
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
* SVG-Based Prettiness
 | 
					* SVG-Based Prettiness
 | 
				
			||||||
While I'm intrigued with [[https://github.com/rougier][Nicolas P. Rougier]]'s [[https://github.com/rougier/notebook-mode][notebook project]], I really just want to steal their [[https://github.com/rougier/svg-lib][svg-lib project]] that allows me to create and display various SVG objects, namely tags, progress bars, progress pies and icons.  Each object fits nicely in a text buffer ensuring width is an integer multiple of character width.
 | 
					While I'm intrigued with [[https://github.com/rougier][Nicolas P. Rougier]]'s [[https://github.com/rougier/notebook-mode][notebook project]], I really just want to steal their [[https://github.com/rougier/svg-lib][svg-lib project]] that allows me to create and display various SVG objects, namely tags, progress bars, progress pies and icons.  Each object fits nicely in a text buffer ensuring width is an integer multiple of character width.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -228,53 +156,58 @@ While I'm intrigued with [[https://github.com/rougier][Nicolas P. Rougier]]'s [[
 | 
				
			||||||
    :straight (:type git :protocol ssh :host github :repo "rougier/svg-lib"))
 | 
					    :straight (:type git :protocol ssh :host github :repo "rougier/svg-lib"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  (use-package svg-tag-mode
 | 
					  (use-package svg-tag-mode
 | 
				
			||||||
    :straight (:type git :protocol ssh :host github :repo "rougier/svg-tag-mode"))
 | 
					    :straight (:type git :protocol ssh :host github :repo "rougier/svg-tag-mode")
 | 
				
			||||||
 | 
					    :config
 | 
				
			||||||
 | 
					    (setq svg-tag-tags
 | 
				
			||||||
 | 
					          '(("TODO:" . ((lambda (tag) (svg-tag-make "TODO" :face 'org-tag
 | 
				
			||||||
 | 
					                                                    :radius 2 :inverse t
 | 
				
			||||||
 | 
					                                                    :margin 0 :padding 0 :height 0.8))))
 | 
				
			||||||
 | 
					            ("NOTE:" . ((lambda (tag) (svg-tag-make "NOTE" :face 'font-lock-comment-face
 | 
				
			||||||
 | 
					                                                    :inverse nil :margin 0 :radius 2 :height 0.8))))
 | 
				
			||||||
 | 
					            ; The org-modern overrides this:
 | 
				
			||||||
 | 
					            ; ("#\\+RESULTS:" . ((lambda (tag) (svg-tag-make tag :beg 0 :end -1 :height 0.6))))
 | 
				
			||||||
 | 
					            ("\\(:[A-Z-]+\\):[a-zA-Z#0-9]+:" . ((lambda (tag)
 | 
				
			||||||
 | 
					                                                 (svg-tag-make tag :beg 1 :inverse t
 | 
				
			||||||
 | 
					                                                               :margin 0 :crop-right t))))
 | 
				
			||||||
 | 
					            (":[A-Z-]+\\(:[a-zA-Z#0-9]+:\\)" . ((lambda (tag)
 | 
				
			||||||
 | 
					                                                 (svg-tag-make tag :beg 1 :end -1
 | 
				
			||||||
 | 
					                                                               :margin 0 :crop-left t))))
 | 
				
			||||||
 | 
					            ("\\(:[A-Z-]+:\\)[ \n]" . ((lambda (tag) (svg-tag-make tag :beg 1 :end -1 :margin 0))))))
 | 
				
			||||||
 | 
					    (global-svg-tag-mode 1))
 | 
				
			||||||
 | 
					#+END_SRC
 | 
				
			||||||
 | 
					What does do? Here are some examples:
 | 
				
			||||||
 | 
					  TODO: Marks comments for tasks (this can be in source files too).
 | 
				
			||||||
 | 
					  NOTE: Highlights comments and other notes.
 | 
				
			||||||
 | 
					  :PROP:tag: are highlighted as two parts of the same tag
 | 
				
			||||||
 | 
					  And :TAG: with colons are highlighted, which include :PROPERTY: drawers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When the project is more complete, I need to dive into this:
 | 
				
			||||||
 | 
					#+BEGIN_SRC emacs-lisp :tangle no
 | 
				
			||||||
  (use-package notebook
 | 
					  (use-package notebook
 | 
				
			||||||
    :straight (:type git :protocol ssh :host github :repo "rougier/notebook")
 | 
					    :straight (:type git :protocol ssh :host github :repo "rougier/notebook")
 | 
				
			||||||
    :after org
 | 
					    :after org
 | 
				
			||||||
    :hook (org-mode . notebook-mode))
 | 
					    :hook (org-mode . notebook-mode))
 | 
				
			||||||
#+END_SRC
 | 
					#+END_SRC
 | 
				
			||||||
* Padding
 | 
					 | 
				
			||||||
The [[https://github.com/TonCherAmi/org-padding][org-padding]] project looks places extra space before and after headers and blocks (essentially leading), to create a more word-processor-y experience. Great idea, however, I have spent a lot of extra time entering blank lines before and after my headers and blocks:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In the interim, let’s use [[https://github.com/minad/org-modern][org-modern]] mode:
 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					#+BEGIN_SRC emacs-lisp
 | 
				
			||||||
(use-package org-padding
 | 
					  (use-package org-modern
 | 
				
			||||||
  :straight (:type git :protocol ssh :host github :repo "TonCherAmi/org-padding")
 | 
					    :straight (:type git :protocol ssh :host github :repo "minad/org-modern")
 | 
				
			||||||
  :hook
 | 
					    :custom (org-modern-label-border 0.4
 | 
				
			||||||
  (org-mode . org-padding-mode)
 | 
					             org-modern-variable-pitch t
 | 
				
			||||||
  :config
 | 
					             org-modern-tag  nil  ; Letting svg-tag do this
 | 
				
			||||||
  (setq org-padding-block-begin-line-padding '(0.5 . 0.3)
 | 
					             org-modern-list . '((?+ . "◦")
 | 
				
			||||||
        org-padding-block-end-line-padding '(0.1 . 0.5)
 | 
					                                 (?- . "•")
 | 
				
			||||||
        org-padding-heading-padding-alist
 | 
					                                 (?* . "●")))
 | 
				
			||||||
        '((4.0 . 1.5) (3.0 . 0.5) (3.0 . 0.5) (3.0 . 0.5) (2.5 . 0.5) (2.0 . 0.5) (1.5 . 0.5) (0.5 . 0.5))))
 | 
					    :config
 | 
				
			||||||
 | 
					    (setq org-auto-align-tags nil
 | 
				
			||||||
 | 
					          org-tags-column 0)
 | 
				
			||||||
 | 
					    :hook
 | 
				
			||||||
 | 
					    (org-mode . org-modern-mode)
 | 
				
			||||||
 | 
					    (org-agenda-finalize . org-modern-agenda))
 | 
				
			||||||
#+END_SRC
 | 
					#+END_SRC
 | 
				
			||||||
However, I'm just going to have to write a function to clean this.
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
(defun ha-remove-superfluous-org-padding ()
 | 
					 | 
				
			||||||
  (interactive)
 | 
					 | 
				
			||||||
  (goto-char (point-min))
 | 
					 | 
				
			||||||
  (ha-remove-org-header-padding)
 | 
					 | 
				
			||||||
  (goto-char (point-min))
 | 
					 | 
				
			||||||
  (ha-remove-org-block-padding))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ha-remove-org-header-padding ()
 | 
					I liked the approach to the [[https://github.com/TonCherAmi/org-padding][org-padding]] project in how it allowed granular tweaks to add extra padding. This package doesn’t work with =org-modern=, but I may look more into it later.
 | 
				
			||||||
  ;; (goto-char (point-min))
 | 
					 | 
				
			||||||
  (while (re-search-forward (rx (optional bol (zero-or-more space) eol "\n")
 | 
					 | 
				
			||||||
                                (group bol (one-or-more "*") (one-or-more space) (one-or-more any) "\n")
 | 
					 | 
				
			||||||
                                (optional bol (zero-or-more space) eol "\n")) nil t)
 | 
					 | 
				
			||||||
    (replace-match (match-string 1) nil :no-error)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defun ha-remove-org-block-padding ()
 | 
					 | 
				
			||||||
  ;; (goto-char (point-min))
 | 
					 | 
				
			||||||
  (while (re-search-forward (rx (optional bol (zero-or-more space) eol "\n")
 | 
					 | 
				
			||||||
                                (group bol (zero-or-more space) "#+BEGIN" (one-or-more any) eol "\n"
 | 
					 | 
				
			||||||
                                       (zero-or-more (group bol (zero-or-more any) eol "\n"))
 | 
					 | 
				
			||||||
                                       bol (zero-or-more space) "#+END" (zero-or-more any) eol "\n")
 | 
					 | 
				
			||||||
                                (optional bol (zero-or-more space) eol "\n")) nil t)
 | 
					 | 
				
			||||||
    (replace-match (match-string 1) nil :no-error)))
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
Now that is some complicated regular expressions.
 | 
					 | 
				
			||||||
* Pasting
 | 
					* Pasting
 | 
				
			||||||
I like the idea that I will paste HTML text from the clipboard and have it converted to org-formatted text:
 | 
					I like the idea that I will paste HTML text from the clipboard and have it converted to org-formatted text:
 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					#+BEGIN_SRC emacs-lisp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,10 +108,9 @@ Can we get Racket working with Org?
 | 
				
			||||||
    :config
 | 
					    :config
 | 
				
			||||||
    (add-to-list 'org-babel-load-languages '(racket . t)))
 | 
					    (add-to-list 'org-babel-load-languages '(racket . t)))
 | 
				
			||||||
#+END_SRC
 | 
					#+END_SRC
 | 
				
			||||||
 | 
					 | 
				
			||||||
** Try It Out
 | 
					** Try It Out
 | 
				
			||||||
:PROPERTIES:
 | 
					:PROPERTIES:
 | 
				
			||||||
:header-args:racket: :session racketeering :results value replace :lang racket
 | 
					:HEADER-ARGS:racket: :session racketeering :results value replace :lang racket
 | 
				
			||||||
:END:
 | 
					:END:
 | 
				
			||||||
Working for values?
 | 
					Working for values?
 | 
				
			||||||
#+BEGIN_SRC racket
 | 
					#+BEGIN_SRC racket
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue