aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2023-08-19 07:41:42 -0700
committercolin <colin@cicadas.surf>2023-08-19 07:41:42 -0700
commit2d0a3f27c13fbf314d6193c26f0ede6ba237aeec (patch)
treecb781f73599783c304b5389a0ca8378e144db6df
parent9ab933644cc6bec18c0cf3ec6de3c323c2494578 (diff)
special insert mode; org protocol config
-rw-r--r--init-el.org111
1 files changed, 97 insertions, 14 deletions
diff --git a/init-el.org b/init-el.org
index c5152d0..f025e92 100644
--- a/init-el.org
+++ b/init-el.org
@@ -150,7 +150,7 @@ New in emacs 28, native compilation can be enabled:
(def-my-command my-leader-command
'((?/ "[/] search buffer" swiper)
(?q "[q]uery replace" query-replace)
- (?i "[i]menu" imenu)
+ (?i "[i]nsert" my-special-insert)
(?' "['] shell" persp-shell--jump-to-persp-shell)
(?b "[b]uffers" my-buffer-command)
(?c "[c]apture" org-capture)
@@ -215,6 +215,25 @@ New in emacs 28, native compilation can be enabled:
+** My leader key Special inserts
+
+#+name: my-special-inserts
+#+begin_src elisp :noweb no-export
+
+(defun inserter (what)
+ (lexical-let ((what what))
+ (lambda ()
+ (interactive)
+ (insert what))))
+
+(def-my-command my-special-insert
+ `((?l "[l] λ" ,(inserter "λ"))))
+
+#+end_src
+
+#+RESULTS: my-special-inserts
+: my-special-insert
+
* Org Mode Configs
#+name: org-mode-config
@@ -222,6 +241,7 @@ New in emacs 28, native compilation can be enabled:
<<org-mode-main-config>>
<<org-mode-babel-config>>
<<org-mode-leader-key-menu>>
+<<org-protocol-config>>
#+end_src
** Org Mode Main Config
@@ -367,7 +387,68 @@ New in emacs 28, native compilation can be enabled:
#+end_src
+** Org Protocol Config
+
+Following the guide [[https://orgmode.org/worg/org-contrib/org-protocol.html][here]] about setting up org protocol and emacs
+server.
+
+This allows emacs to intercept org protocol requests from emacsclient
+in order to take some actions. I'm using it here as part of a DIY
+read-it-later app - I can push a button in my web browser and cache an
+article for later reading.
+
+*** Org init.el config
+First, update the config
+
+#+name: org-protocol-config
+#+begin_src elisp :noweb no-export
+
+(server-start)
+(require 'org-protocol)
+
+#+end_src
+
+*** desktop entry
+Second, make an org-protocol desktop entry
+
+#+begin_src config :tangle ~/.local/share/applications/org-protocol.desktop :results none
+
+[Desktop Entry]
+Name=org-protocol
+Comment=Intercept calls from emacsclient to trigger custom actions
+Categories=Other;
+Keywords=org-protocol;
+Icon=emacs
+Type=Application
+Exec=emacsclient -- %u
+Terminal=false
+StartupWMClass=Emacs
+MimeType=x-scheme-handler/org-protocol;
+
+#+end_src
+
+and tell your system about it. You might need to install something:
+
+#+begin_src bash
+sudo apt-get install desktop-file-utils
+#+end_src
+
+Then run this:
+
+#+begin_src bash
+update-desktop-database ~/.local/share/applications/
+#+end_src
+
+#+RESULTS:
+
+Finally, to actually use it, make a book mark like so:
+
+e.g. here's one for org capture
+
+#+begin_src
+ javascript:location.href='org-protocol://capture:/w/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
+#+end_src
* UI
@@ -609,7 +690,9 @@ New in emacs 28, native compilation can be enabled:
nezburn-theme
sunburn-theme
moe-theme
- solarized-theme))
+ solarized-theme
+ twilight-bright-theme
+ zweilight-theme))
(dolist (package my-installed-themes)
@@ -625,6 +708,7 @@ New in emacs 28, native compilation can be enabled:
(setq *coding-themes*
'(modus-operandi-tritanopia
+ twilight-bright
moe-light
solarized-selenized-light
goose
@@ -635,6 +719,7 @@ New in emacs 28, native compilation can be enabled:
sweet
nezburn
wildcharm
+ zweilight
modus-vivendi))
(setq *writing-themes*
@@ -867,7 +952,11 @@ stand up and move around.
(setq org-capture-templates
(quote
- (("i" "Inbox" entry
+ (
+ ("w" "Web" entry
+ (file+olp+datetree "~/notes/deft/Web.org" "Weblink")
+ "* TOREAD %:annotation \n\n %i\n\n")
+ ("i" "Inbox" entry
(file+headline "~/notes/deft/project-Planner.org" "INBOX")
"")
("j" "Journal" entry
@@ -1046,6 +1135,7 @@ stand up and move around.
(setq elfeed-feeds
'(("https://harpers.org/feed" culture politics news)
("https://solar.lowtechmagazine.com/posts/index.xml" technology)
+ ("http://feeds.feedburner.com/FutilityCloset" art culture)
("http://feeds2.feedburner.com/NoTechMagazine" technology)
("http://www.thingsmagazine.net/feed" art culture)
("https://commonstransition.org/feed/" commons p2p)
@@ -1444,22 +1534,15 @@ from debian contrib
#+name: slime-tweaks
#+begin_src elisp :noweb no-export
+(defvar +symbols-in-cl+ 977)
+
(defun slime-random-words-of-encouragement ()
"Return a string of hackerish encouragement."
(slime-eval
- '(swank:documentation-symbol
+ `(swank:documentation-symbol
(cl:loop :for name :being :each :symbol :in (cl:find-package "CL")
:collect (cl:symbol-name name) :into names
- :count 1 :into size
- :finally
- (cl:let* ((rs (cl:make-random-state))
- (state (sb-kernel::random-state-state rs)))
- (cl:loop :for idx :from 3 :below (cl:length state) :do
- (cl:setf (cl:elt state idx)
- (cl:mod (cl:+ (cl:get-universal-time)
- (cl:elt state idx))
- #xffffffff)))
- (cl:return (cl:elt names (cl:random size rs))))))))
+ :finally (cl:return (cl:elt names ,(random +symbols-in-cl+)))))))