summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-08-19 18:16:21 -0500
committerCase Duckworth2021-08-19 18:16:21 -0500
commit6aa1d6b3c2b7b4e8ca4bc2b93d12fd0663f5956d (patch)
treed88bdb8cfb929aec116f0e359e1f64db5a2ded00
parentAuto revert non-file buffers (diff)
parentMerge branch 'main' of tildegit.org:acdw/emacs (diff)
downloademacs-6aa1d6b3c2b7b4e8ca4bc2b93d12fd0663f5956d.tar.gz
emacs-6aa1d6b3c2b7b4e8ca4bc2b93d12fd0663f5956d.zip
Merge branch 'main' of https://tildegit.org/acdw/emacs
-rw-r--r--init.el120
-rw-r--r--lisp/acdw.el36
2 files changed, 108 insertions, 48 deletions
diff --git a/init.el b/init.el index 677a737..0ffe042 100644 --- a/init.el +++ b/init.el
@@ -416,45 +416,73 @@ like a dumbass."
416 (defun unfocused@save-buffers () 416 (defun unfocused@save-buffers ()
417 (save-some-buffers t)))) 417 (save-some-buffers t))))
418 418
419(setup flyspell 419;; (setup flyspell
420 ;; follow the directions here: https://old.reddit.com/r/emacs/comments/dgj0ae 420;; ;; follow the directions here: https://old.reddit.com/r/emacs/comments/dgj0ae
421 ;; in short: 421;; ;; in short:
422 ;; - download hunspell from GitHub and put in ~/usr/bin 422;; ;; - download hunspell from GitHub and put in ~/usr/bin
423 ;; - download LibreOffice English dictionaries and put in 423;; ;; - download LibreOffice English dictionaries and put in
424 ;; ~/usr/share/hunspell 424;; ;; ~/usr/share/hunspell
425 (setq-default 425;; (setq-default
426 flyspell-issue-message-flag nil 426;; flyspell-issue-message-flag nil
427 ispell-program-name "hunspell" 427;; ispell-program-name "hunspell"
428 ispell-dictionary "en_US" 428;; ispell-dictionary "default"
429 ispell-personal-dictionary "~/.hunspell_personal" 429;; ispell-personal-dictionary "~/.hunspell_personal"
430 ispell-local-dictionary-alist '(("en_US" 430;; ispell-local-dictionary-alist '(("default"
431 "[[:alpha:]]" "[^[:alpha:]]" 431;; "[[:alpha:]]" "[^[:alpha:]]"
432 "[']" nil 432;; "[']" nil
433 ("-d" "en_US") nil utf-8))) 433;; ("-d" "en_US") nil utf-8)))
434 434
435 (acdw/system 435;; (acdw/system
436 (:work (setenv "DICPATH" (expand-file-name "~/usr/share/hunspell")))) 436;; (:work (let ((dicpath (expand-file-name "~/usr/share/hunspell/")))
437 437;; (setenv "DICPATH" dicpath))))
438 (when (boundp 'ispell-hunspell-dictionary-alist) 438
439 (setq-default 439;; ;; new variable `ispell-hunspell-dictionary-alist' is defined in Emacs
440 ispell-hunspell-dictionary-alist ispell-local-dictionary-alist)) 440;; ;; If it's nil, Emacs tries to automatically set up the dictionaries.
441 (:needs ispell-program-name) ; don't proceed if not installed 441;; (when (boundp 'ispell-hunspell-dictionary-alist)
442 442;; (setq ispell-hunspell-dictionary-alist ispell-local-dictionary-alist))
443 (unless (file-exists-p ispell-personal-dictionary) 443
444 (write-region "" nil ispell-personal-dictionary nil 0)) 444;; (:needs ispell-program-name) ; don't proceed if not installed
445 445
446 (when (executable-find ispell-program-name) 446;; (unless (file-exists-p ispell-personal-dictionary)
447 (add-hook 'text-mode-hook #'flyspell-mode) 447;; (write-region "" nil ispell-personal-dictionary nil 0))
448 (add-hook 'prog-mode-hook #'flyspell-prog-mode)) 448
449 449;; (when (executable-find ispell-program-name)
450 (:when-loaded 450;; (add-hook 'text-mode-hook #'flyspell-mode)
451 (setup (:straight flyspell-correct) 451;; (add-hook 'prog-mode-hook #'flyspell-prog-mode))
452 (:with-map flyspell-mode-map 452
453 (:bind "C-;" flyspell-correct-wrapper 453;; (:when-loaded
454 ;; Remove all other binds 454;; (setup (:straight flyspell-correct)
455 "C-," nil 455;; (:with-map flyspell-mode-map
456 "C-." nil 456;; (:bind "C-;" flyspell-correct-wrapper
457 "C-M-i" nil))))) 457;; ;; Remove all other binds
458;; "C-," nil
459;; "C-." nil
460;; "C-M-i" nil)))))
461
462;; (setup flyspell
463;; (:option
464;; flyspell-issue-message-flag nil
465;; ispell-program-name "aspell"
466;; ispell-dictionary "en_US"
467;; ispell-personal-dictionary "~/.dictionary"
468;; ispell-extra-args '("--sug-mode=ultra" "--lang=en_US"))
469
470;; (:needs ispell-program-name)
471
472;; (unless (file-exists-p ispell-personal-dictionary)
473;; (write-region "" nil ispell-personal-dictionary nil 0))
474
475;; (add-hook 'text-mode-hook #'flyspell-mode)
476;; (add-hook 'prog-mode-hook #'flyspell-prog-mode)
477
478;; (:when-loaded
479;; (setup (:straight flyspell-correct)
480;; (:with-map flyspell-mode-map
481;; (:bind "C-;" flyspell-correct-wrapper
482;; ;; Remove other binds
483;; "C-," nil
484;; "C-." nil
485;; "C-M-i" nil)))))
458 486
459(setup frames 487(setup frames
460 (:option frame-title-format '("%b@" 488 (:option frame-title-format '("%b@"
@@ -822,7 +850,7 @@ like a dumbass."
822 850
823(setup (:straight (0x0 :host gitlab 851(setup (:straight (0x0 :host gitlab
824 :repo "willvaughn/emacs-0x0")) 852 :repo "willvaughn/emacs-0x0"))
825 (:option 0x0-default-host 'ttm)) 853 (:option 0x0-default-server 'ttm))
826 854
827(setup (:straight (apheleia :host github 855(setup (:straight (apheleia :host github
828 :repo "raxod502/apheleia")) 856 :repo "raxod502/apheleia"))
@@ -1119,11 +1147,21 @@ successive invocations."
1119 (add-to-list 'auto-mode-alist '("\\.fb\\'" . forth-block-mode)))) 1147 (add-to-list 'auto-mode-alist '("\\.fb\\'" . forth-block-mode))))
1120 1148
1121(setup (:straight helpful) 1149(setup (:straight helpful)
1150 (:option helpful-max-buffers 5
1151 ;;helpful-switch-buffer-function #'pop-to-buffer
1152 helpful-switch-buffer-function
1153 (lambda (buf)
1154 (pop-to-buffer buf
1155 '((display-buffer-reuse-mode-window
1156 display-buffer-pop-up-window)
1157 (mode . helpful-mode))
1158 :norecord)))
1122 (:global "<help> f" helpful-callable 1159 (:global "<help> f" helpful-callable
1123 "<help> v" helpful-variable 1160 "<help> v" helpful-variable
1124 "<help> k" helpful-key 1161 "<help> k" helpful-key
1125 "<help> o" helpful-symbol 1162 "<help> o" helpful-symbol
1126 "C-c C-d" helpful-at-point)) 1163 "C-c C-d" helpful-at-point)
1164 (:bind "q" kill-buffer-and-window))
1127 1165
1128(setup (:straight iscroll) 1166(setup (:straight iscroll)
1129 (:hook-into text-mode)) 1167 (:hook-into text-mode))
diff --git a/lisp/acdw.el b/lisp/acdw.el index 27f5eff..f642c65 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -313,16 +313,38 @@ With a prefix argument, run git pull on the repo first."
313(defun acdw/copy-region-plain (start end) 313(defun acdw/copy-region-plain (start end)
314 "Copy a region to clipboard, removing all Org formatting." 314 "Copy a region to clipboard, removing all Org formatting."
315 (interactive "*r") 315 (interactive "*r")
316 (let ((s (buffer-substring-no-properties start end))) 316 (let ((s (buffer-substring-no-properties start end))
317 (extracted-heading (when (derived-mode-p 'org-mode)
318 (acdw/org-extract-heading-text))))
317 (with-temp-buffer 319 (with-temp-buffer
318 (insert s) 320 (insert s)
319 (let ((sentence-end-double-space nil)) 321 (let ((sentence-end-double-space nil))
320 (unfill-region (point-min) (point-max))) 322 ;; Remove org stuff
321 (copy-region-as-kill (point-min) (point-max))) 323 (when extracted-heading ; Replace org heading with plaintext
322 (when (called-interactively-p 'interactive) 324 (goto-char (point-min))
323 (indicate-copied-region)) 325 (kill-line)
324 (setq deactivate-mark t) 326 (insert extracted-heading))
325 nil)) 327 (replace-regexp org-property-drawer-re "") ;Delete properties
328 (replace-regexp org-logbook-drawer-re "") ;Delete logbook
329 (replace-regexp org-list-full-item-re "
330\4")
331 ;; Re-fill text for clipboard
332 (unfill-region (point-min) (point-max))
333 (flush-lines "^$" (point-min) (point-max)))
334 ;; Copy buffer
335 (copy-region-as-kill (point-min) (point-max))))
336 (when (called-interactively-p 'interactive)
337 (indicate-copied-region))
338 (setq deactivate-mark t)
339 nil)
340
341(defun acdw/org-extract-heading-text ()
342 (let ((heading (org-no-properties (org-get-heading t t t t))))
343 (message
344 (replace-regexp-in-string org-link-bracket-re
345 (lambda (match)
346 (match-string-no-properties 2 match))
347 heading))))
326 348
327(defun acdw/dir (&optional file make-directory) 349(defun acdw/dir (&optional file make-directory)
328 "Place Emacs files in one place. 350 "Place Emacs files in one place.