summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-06-01 22:30:05 -0500
committerCase Duckworth2021-06-01 22:30:05 -0500
commit6fd355d978c0f6146ed101effa12661453ecea04 (patch)
tree0afa3b584c8282e7e5473ef7cacee82d0d0c4c70 /lisp
parentChange Gnus keybind (diff)
downloademacs-6fd355d978c0f6146ed101effa12661453ecea04.tar.gz
emacs-6fd355d978c0f6146ed101effa12661453ecea04.zip
Add ORG functionality
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-org.el52
1 files changed, 52 insertions, 0 deletions
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index 7e68712..a9c0a8c 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -301,5 +301,57 @@ the deletion might narrow the column."
301 (message "%d words in buffer" 301 (message "%d words in buffer"
302 (acdw-org/count-words (point-min) (point-max)))))) 302 (acdw-org/count-words (point-min) (point-max))))))
303 303
304
305;;; Zero-width spaces
306;; https://blog.tecosaur.com/tmio/2021-05-31-async.html#easy-zero-width
307
308(defun insert-zero-width-space ()
309 "Insert a zero-width space."
310 (interactive)
311 (insert "\u200b"))
304 312
313(defun org-export-remove-zero-width-spaces (text _backend _info)
314 "Remove zero-width spaces from TEXT."
315 (unless (org-export-derived-backend-p 'org)
316 (replace-regexp-in-string "\u200b" "" text)))
317
318
319;;; Insert links .. DWIM
320;; https://xenodium.com/emacs-dwim-do-what-i-mean/
321
322(defun org-insert-link-dwim ()
323 "Like `org-insert-link' but with personal dwim preferences."
324 (interactive)
325 (let* ((point-in-link (org-in-regexp org-link-any-re 1))
326 (clipboard-url (when (string-match-p
327 (rx (sequence bos
328 (or "http"
329 "gemini"
330 "gopher")))
331 (current-kill 0))
332 (current-kill 0)))
333 (region-content (when (region-active-p)
334 (buffer-substring-no-properties (region-beginning)
335 (region-end)))))
336 (cond ((and region-content clipboard-url (not point-in-link))
337 (delete-region (region-beginning) (region-end))
338 (insert (org-make-link-string clipboard-url region-content)))
339 ((and clipboard-url (not point-in-link))
340 (insert (org-make-link-string
341 clipboard-url
342 (read-string "title: "
343 (with-current-buffer
344 (url-retrieve-synchronously
345 clipboard-url)
346 (dom-text
347 (car
348 (dom-by-tag (libxml-parse-html-region
349 (point-min)
350 (point-max))
351 'title))))))))
352 (t
353 (call-interactively 'org-insert-link)))))
354
355
305(provide 'acdw-org) 356(provide 'acdw-org)
357;; acdw-org.el ends here