summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-10-17 21:27:59 -0500
committerCase Duckworth2022-10-17 21:27:59 -0500
commit3e78d1f8ca5b100f39577790614433398bc6a422 (patch)
treef65f3164ac143c81da877375adce7f1f1492a01f /lisp
parentbleh (diff)
downloademacs-3e78d1f8ca5b100f39577790614433398bc6a422.tar.gz
emacs-3e78d1f8ca5b100f39577790614433398bc6a422.zip
asoi
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+chicken.el12
-rw-r--r--lisp/+emacs.el14
-rw-r--r--lisp/+org.el76
3 files changed, 67 insertions, 35 deletions
diff --git a/lisp/+chicken.el b/lisp/+chicken.el index 55fc48e..15713f8 100644 --- a/lisp/+chicken.el +++ b/lisp/+chicken.el
@@ -18,5 +18,17 @@
18 "awful" "--development-mode" (buffer-file-name)))) 18 "awful" "--development-mode" (buffer-file-name))))
19 (t (message "Some awful error occurred!")))) 19 (t (message "Some awful error occurred!"))))
20 20
21(defun +chicken-indentation-insinuate ()
22 "Insinuate indentation from
23https://wiki.call-cc.org/emacs#tweaking-stock-scheme-mode-indentation."
24 (defun scheme-module-indent (state indent-point normal-indent) 0)
25 (put 'module 'scheme-indent-function 'scheme-module-indent)
26 (put 'and-let* 'scheme-indent-function 1)
27 (put 'parameterize 'scheme-indent-function 1)
28 (put 'handle-exceptions 'scheme-indent-function 1)
29 (put 'when 'scheme-indent-function 1)
30 (put 'unless 'scheme-indent-function 1)
31 (put 'match 'scheme-indent-function 1))
32
21(provide '+chicken) 33(provide '+chicken)
22;;; +chicken.el ends here 34;;; +chicken.el ends here
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index b69d1a0..9158b62 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -316,8 +316,9 @@ ARG is passed to `backward-kill-word'."
316 316
317(defun +save-some-buffers-p () 317(defun +save-some-buffers-p ()
318 "Predicate for `save-some-buffers-default-predicate'. 318 "Predicate for `save-some-buffers-default-predicate'.
319It returns nil with remote files." 319It returns nil with remote files and those without attached files."
320 (not (file-remote-p (buffer-file-name)))) 320 (and (buffer-file-name)
321 (not (file-remote-p (buffer-file-name)))))
321 322
322;; https://www.wwwtech.de/articles/2013/may/emacs:-jump-to-matching-paren-beginning-of-block 323;; https://www.wwwtech.de/articles/2013/may/emacs:-jump-to-matching-paren-beginning-of-block
323(defun +goto-matching-paren (&optional arg) 324(defun +goto-matching-paren (&optional arg)
@@ -333,6 +334,14 @@ It returns nil with remote files."
333 ((looking-back "[\[\(\{]" 1) (backward-char) (forward-sexp arg)) 334 ((looking-back "[\[\(\{]" 1) (backward-char) (forward-sexp arg))
334 (t (up-list arg t t)))) 335 (t (up-list arg t t))))
335 336
337(defun +delete-window-or-bury-buffer ()
338 "Delete the current window, or bury the current buffer.
339If the current window is the only window, bury the buffer."
340 (interactive)
341 (condition-case e
342 (delete-window)
343 (t (bury-buffer))))
344
336 345
337;;; Bindings 346;;; Bindings
338 347
@@ -348,6 +357,7 @@ It returns nil with remote files."
348(global-set-key (kbd "C-x 4 n") #'clone-buffer) 357(global-set-key (kbd "C-x 4 n") #'clone-buffer)
349;; https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/ 358;; https://christiantietze.de/posts/2022/07/shift-click-in-emacs-to-select/
350(global-set-key (kbd "S-<down-mouse-1>") #'mouse-set-mark) 359(global-set-key (kbd "S-<down-mouse-1>") #'mouse-set-mark)
360(global-set-key (kbd "C-x 0") #'+delete-window-or-bury-buffer)
351 361
352 362
353;;; Required libraries 363;;; Required libraries
diff --git a/lisp/+org.el b/lisp/+org.el index 2557671..dc0ce1b 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -343,6 +343,7 @@ Return as a list."
343 (+org-unsmartify) 343 (+org-unsmartify)
344 (+org-fix-blank-lines t) 344 (+org-fix-blank-lines t)
345 (org-align-tags t) 345 (org-align-tags t)
346 (org-hide-drawer-all)
346 (when (buffer-narrowed-p) 347 (when (buffer-narrowed-p)
347 (goto-char (point-min)) 348 (goto-char (point-min))
348 (forward-line 1) 349 (forward-line 1)
@@ -731,39 +732,48 @@ When called with a prefix ARG, will still unconditionally call
731 732
732 733
733;;; move org archives to a dedicated file 734;;; move org archives to a dedicated file
734(defun +org-archive-monthwise (archive-file) 735;; (defun +org-archive-monthwise (archive-file)
735 (if (file-exists-p archive-file) 736;; (if (file-exists-p archive-file)
736 (with-current-buffer (find-file-noselect archive-file) 737;; (with-current-buffer (find-file-noselect archive-file)
737 (let ((dir (file-name-directory (file-truename archive-file))) 738;; (let ((dir (file-name-directory (file-truename archive-file)))
738 (prog (make-progress-reporter (format "Archiving from %s..." archive-file))) 739;; (prog (make-progress-reporter (format "Archiving from %s..." archive-file)))
739 (keep-going t)) 740;; (keep-going t))
740 (goto-char (point-min)) 741;; (goto-char (point-min))
741 (while keep-going 742;; (while keep-going
742 (when-let* ((time (or (org-entry-get (point) "ARCHIVE_TIME") 743;; (when-let* ((time (or (org-entry-get (point) "ARCHIVE_TIME")
743 (org-get-deadline-time (point)))) 744;; (org-get-deadline-time (point))))
744 (parsed-time (and time 745;; (parsed-time (and time
745 (org-parse-time-string time))) 746;; (org-parse-time-string time)))
746 (refile-target (format "%s%02d-%02d.org" 747;; (refile-target (format "%s%02d-%02d.org"
747 dir 748;; dir
748 (decoded-time-year parsed-time) 749;; (decoded-time-year parsed-time)
749 (decoded-time-month parsed-time))) 750;; (decoded-time-month parsed-time)))
750 (title-str (format "#+title: Archive for %02d-%02d (%s)\n\n" 751;; (title-str (format "#+title: Archive for %02d-%02d (%s)\n\n"
751 (decoded-time-year parsed-time) 752;; (decoded-time-year parsed-time)
752 (decoded-time-month parsed-time) 753;; (decoded-time-month parsed-time)
753 (file-truename archive-file)))) 754;; (file-truename archive-file))))
754 (unless (file-exists-p refile-target) 755;; (unless (file-exists-p refile-target)
755 (with-current-buffer (find-file-noselect refile-target) 756;; (with-current-buffer (find-file-noselect refile-target)
756 (insert title-str) 757;; (insert title-str)
757 (save-buffer))) 758;; (save-buffer)))
758 (org-refile nil nil (list "" 759;; (org-refile nil nil (list ""
759 refile-target 760;; refile-target
760 nil 761;; nil
761 0))) 762;; 0)))
762 (progress-reporter-update prog) 763;; (progress-reporter-update prog)
763 (org-next-visible-heading 1) 764;; (org-next-visible-heading 1)
764 (when (>= (point) (point-max)) 765;; (when (>= (point) (point-max))
765 (setq keep-going nil))))) 766;; (setq keep-going nil)))))
766 (message "Archive file %s does not exist!" archive-file))) 767;; (message "Archive file %s does not exist!" archive-file)))
768
769
770;;; +org-toggle-view-emphasis
771;; I thought this function was already written somewhere...
772(defun +org-toggle-view-emphasis ()
773 "Toggle `org-hide-emphasis-markers' and redraw the buffer."
774 (interactive)
775 (setq-local org-hide-emphasis-markers (not org-hide-emphasis-markers))
776 (font-lock-update))
767 777
768 778
769;;; el-patch 779;;; el-patch