diff options
-rw-r--r-- | init.el | 120 | ||||
-rw-r--r-- | lisp/acdw.el | 36 |
2 files changed, 108 insertions, 48 deletions
diff --git a/init.el b/init.el index 0cd9c59..e17917b 100644 --- a/init.el +++ b/init.el | |||
@@ -414,45 +414,73 @@ like a dumbass." | |||
414 | (defun unfocused@save-buffers () | 414 | (defun unfocused@save-buffers () |
415 | (save-some-buffers t)))) | 415 | (save-some-buffers t)))) |
416 | 416 | ||
417 | (setup flyspell | 417 | ;; (setup flyspell |
418 | ;; follow the directions here: https://old.reddit.com/r/emacs/comments/dgj0ae | 418 | ;; ;; follow the directions here: https://old.reddit.com/r/emacs/comments/dgj0ae |
419 | ;; in short: | 419 | ;; ;; in short: |
420 | ;; - download hunspell from GitHub and put in ~/usr/bin | 420 | ;; ;; - download hunspell from GitHub and put in ~/usr/bin |
421 | ;; - download LibreOffice English dictionaries and put in | 421 | ;; ;; - download LibreOffice English dictionaries and put in |
422 | ;; ~/usr/share/hunspell | 422 | ;; ;; ~/usr/share/hunspell |
423 | (setq-default | 423 | ;; (setq-default |
424 | flyspell-issue-message-flag nil | 424 | ;; flyspell-issue-message-flag nil |
425 | ispell-program-name "hunspell" | 425 | ;; ispell-program-name "hunspell" |
426 | ispell-dictionary "en_US" | 426 | ;; ispell-dictionary "default" |
427 | ispell-personal-dictionary "~/.hunspell_personal" | 427 | ;; ispell-personal-dictionary "~/.hunspell_personal" |
428 | ispell-local-dictionary-alist '(("en_US" | 428 | ;; ispell-local-dictionary-alist '(("default" |
429 | "[[:alpha:]]" "[^[:alpha:]]" | 429 | ;; "[[:alpha:]]" "[^[:alpha:]]" |
430 | "[']" nil | 430 | ;; "[']" nil |
431 | ("-d" "en_US") nil utf-8))) | 431 | ;; ("-d" "en_US") nil utf-8))) |
432 | 432 | ||
433 | (acdw/system | 433 | ;; (acdw/system |
434 | (:work (setenv "DICPATH" (expand-file-name "~/usr/share/hunspell")))) | 434 | ;; (:work (let ((dicpath (expand-file-name "~/usr/share/hunspell/"))) |
435 | 435 | ;; (setenv "DICPATH" dicpath)))) | |
436 | (when (boundp 'ispell-hunspell-dictionary-alist) | 436 | |
437 | (setq-default | 437 | ;; ;; new variable `ispell-hunspell-dictionary-alist' is defined in Emacs |
438 | ispell-hunspell-dictionary-alist ispell-local-dictionary-alist)) | 438 | ;; ;; If it's nil, Emacs tries to automatically set up the dictionaries. |
439 | (:needs ispell-program-name) ; don't proceed if not installed | 439 | ;; (when (boundp 'ispell-hunspell-dictionary-alist) |
440 | 440 | ;; (setq ispell-hunspell-dictionary-alist ispell-local-dictionary-alist)) | |
441 | (unless (file-exists-p ispell-personal-dictionary) | 441 | |
442 | (write-region "" nil ispell-personal-dictionary nil 0)) | 442 | ;; (:needs ispell-program-name) ; don't proceed if not installed |
443 | 443 | ||
444 | (when (executable-find ispell-program-name) | 444 | ;; (unless (file-exists-p ispell-personal-dictionary) |
445 | (add-hook 'text-mode-hook #'flyspell-mode) | 445 | ;; (write-region "" nil ispell-personal-dictionary nil 0)) |
446 | (add-hook 'prog-mode-hook #'flyspell-prog-mode)) | 446 | |
447 | 447 | ;; (when (executable-find ispell-program-name) | |
448 | (:when-loaded | 448 | ;; (add-hook 'text-mode-hook #'flyspell-mode) |
449 | (setup (:straight flyspell-correct) | 449 | ;; (add-hook 'prog-mode-hook #'flyspell-prog-mode)) |
450 | (:with-map flyspell-mode-map | 450 | |
451 | (:bind "C-;" flyspell-correct-wrapper | 451 | ;; (:when-loaded |
452 | ;; Remove all other binds | 452 | ;; (setup (:straight flyspell-correct) |
453 | "C-," nil | 453 | ;; (:with-map flyspell-mode-map |
454 | "C-." nil | 454 | ;; (:bind "C-;" flyspell-correct-wrapper |
455 | "C-M-i" nil))))) | 455 | ;; ;; Remove all other binds |
456 | ;; "C-," nil | ||
457 | ;; "C-." nil | ||
458 | ;; "C-M-i" nil))))) | ||
459 | |||
460 | ;; (setup flyspell | ||
461 | ;; (:option | ||
462 | ;; flyspell-issue-message-flag nil | ||
463 | ;; ispell-program-name "aspell" | ||
464 | ;; ispell-dictionary "en_US" | ||
465 | ;; ispell-personal-dictionary "~/.dictionary" | ||
466 | ;; ispell-extra-args '("--sug-mode=ultra" "--lang=en_US")) | ||
467 | |||
468 | ;; (:needs ispell-program-name) | ||
469 | |||
470 | ;; (unless (file-exists-p ispell-personal-dictionary) | ||
471 | ;; (write-region "" nil ispell-personal-dictionary nil 0)) | ||
472 | |||
473 | ;; (add-hook 'text-mode-hook #'flyspell-mode) | ||
474 | ;; (add-hook 'prog-mode-hook #'flyspell-prog-mode) | ||
475 | |||
476 | ;; (:when-loaded | ||
477 | ;; (setup (:straight flyspell-correct) | ||
478 | ;; (:with-map flyspell-mode-map | ||
479 | ;; (:bind "C-;" flyspell-correct-wrapper | ||
480 | ;; ;; Remove other binds | ||
481 | ;; "C-," nil | ||
482 | ;; "C-." nil | ||
483 | ;; "C-M-i" nil))))) | ||
456 | 484 | ||
457 | (setup frames | 485 | (setup frames |
458 | (:option frame-title-format '("%b@" | 486 | (:option frame-title-format '("%b@" |
@@ -820,7 +848,7 @@ like a dumbass." | |||
820 | 848 | ||
821 | (setup (:straight (0x0 :host gitlab | 849 | (setup (:straight (0x0 :host gitlab |
822 | :repo "willvaughn/emacs-0x0")) | 850 | :repo "willvaughn/emacs-0x0")) |
823 | (:option 0x0-default-host 'ttm)) | 851 | (:option 0x0-default-server 'ttm)) |
824 | 852 | ||
825 | (setup (:straight (apheleia :host github | 853 | (setup (:straight (apheleia :host github |
826 | :repo "raxod502/apheleia")) | 854 | :repo "raxod502/apheleia")) |
@@ -1117,11 +1145,21 @@ successive invocations." | |||
1117 | (add-to-list 'auto-mode-alist '("\\.fb\\'" . forth-block-mode)))) | 1145 | (add-to-list 'auto-mode-alist '("\\.fb\\'" . forth-block-mode)))) |
1118 | 1146 | ||
1119 | (setup (:straight helpful) | 1147 | (setup (:straight helpful) |
1148 | (:option helpful-max-buffers 5 | ||
1149 | ;;helpful-switch-buffer-function #'pop-to-buffer | ||
1150 | helpful-switch-buffer-function | ||
1151 | (lambda (buf) | ||
1152 | (pop-to-buffer buf | ||
1153 | '((display-buffer-reuse-mode-window | ||
1154 | display-buffer-pop-up-window) | ||
1155 | (mode . helpful-mode)) | ||
1156 | :norecord))) | ||
1120 | (:global "<help> f" helpful-callable | 1157 | (:global "<help> f" helpful-callable |
1121 | "<help> v" helpful-variable | 1158 | "<help> v" helpful-variable |
1122 | "<help> k" helpful-key | 1159 | "<help> k" helpful-key |
1123 | "<help> o" helpful-symbol | 1160 | "<help> o" helpful-symbol |
1124 | "C-c C-d" helpful-at-point)) | 1161 | "C-c C-d" helpful-at-point) |
1162 | (:bind "q" kill-buffer-and-window)) | ||
1125 | 1163 | ||
1126 | (setup (:straight iscroll) | 1164 | (setup (:straight iscroll) |
1127 | (:hook-into text-mode)) | 1165 | (: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. |