From 90056b3191eddccee2954b36ee77137fdec5ce29 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:00:39 -0500 Subject: Add require/ function --- lisp/acdw.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lisp/acdw.el b/lisp/acdw.el index cc73071..50ca00c 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -878,7 +878,23 @@ three blank lines, then place the point on the second one." (newline) (delete-blank-lines) (newline 2) - (previous-line)) + (forward-line -1)) + +(defun require/ (feature &optional filename noerror) + "If FEATURE is not loaded, load it from FILENAME. +This function works just like `require', with one crucial +difference: if the FEATURE name contains a slash, the FILENAME +will as well -- unless, of course, FILENAME is set. This allows +for `require/' to require files within subdirectories of +directories of `load-path'. Of course, NOERROR isn't affected by +the change." + (let* ((feature-name (if (symbolp feature) + (symbol-name feature) + feature)) + (filename (or filename + (and (string-match-p "/" feature-name) + feature-name)))) + (require (intern feature-name) filename noerror))) (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81 From 745722ba42fdf0575a8b450260072fda8e5e2f40 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:01:03 -0500 Subject: Change definition to use seq-some --- init.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/init.el b/init.el index 6467bd9..aa2bb9a 100644 --- a/init.el +++ b/init.el @@ -523,11 +523,10 @@ (defun list-string-match-p (string regexp-list) "Return t if at least one regex in RETGEXP-LIST matches STRING, else nil." - (when string ; if STRING is nil, return nil. - (catch 'found - (dolist (regexp regexp-list) - (when (string-match regexp string) - (throw 'found t)))))) + ;; FINE alphapapa ;P + (seq-some (lambda (regexp) + (string-match regexp string)) + regexp-list)) (defun flymake-unless () "Turn on `flymake-mode', UNLESS it's inhibited. -- cgit 1.4.1-21-gabe81 From c7ef58ec8a4157ac569a755b0090a2e82de0e79b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:01:24 -0500 Subject: Disable nyan mode sometimes --- init.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index aa2bb9a..a633387 100644 --- a/init.el +++ b/init.el @@ -1139,6 +1139,7 @@ specific to most general, they are these: scroll-margin 0 word-wrap t wrap-prefix (repeat-string acdw-irc/left-margin " ") + nyan-mode nil line-number-mode nil column-number-mode nil file-percentage-mode nil) @@ -1860,7 +1861,13 @@ browser defined in `browse-url-secondary-browser-function'." (:option nyan-animate-nyancat nil nyan-bar-length 20 nyan-minimum-window-width fill-column) - (nyan-mode +1)) + (nyan-mode +1) + (defun disable-nyan-mode () + "Disable `nyan-mode' in current buffer." + (setq-local nyan-mode -1)) + (dolist (mode '(eshell-mode + comint-mode)) + (add-hook mode #'disable-nyan-mode))) ;; (setup (:straight olivetti) ;; (:option olivetti-body-width (+ fill-column 4) -- cgit 1.4.1-21-gabe81 From 237cdfa27c344cdaaf59cd9cc3174f187f8d38dc Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:01:38 -0500 Subject: Fix crux-open-file-as-root --- init.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/init.el b/init.el index a633387..7fee7a3 100644 --- a/init.el +++ b/init.el @@ -1253,6 +1253,23 @@ specific to most general, they are these: "C-M-\\" #'crux-cleanup-buffer-or-region "C-x 4 t" #'crux-transpose-windows) + (el-patch-feature crux) + (with-eval-after-load 'crux + (el-patch-defun crux-reopen-as-root () + "Find file as root if necessary. + +Meant to be used as `find-file-hook'. +See also `crux-reopen-as-root-mode'." + (unless (or + ;; This helps fix for `nov-mode', and possibly others. + (el-patch-add (null buffer-file-name)) + (tramp-tramp-file-p buffer-file-name) + (equal major-mode 'dired-mode) + (not (file-exists-p (file-name-directory buffer-file-name))) + (file-writable-p buffer-file-name) + (crux-file-owned-by-user-p buffer-file-name)) + (crux-find-alternate-file-as-root buffer-file-name)))) + (crux-reopen-as-root-mode +1)) ;; (setup (:straight-when -- cgit 1.4.1-21-gabe81 From 1dd6a31da09053f7399edff39362bae75bc938df Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:01:55 -0500 Subject: Don't use orderless-flex --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 7fee7a3..489f278 100644 --- a/init.el +++ b/init.el @@ -1905,7 +1905,8 @@ browser defined in `browse-url-secondary-browser-function'." orderless-component-separator #'orderless-escapable-split-on-space orderless-matching-styles '(orderless-literal orderless-regexp - orderless-flex) + ;; orderless-flex + ) orderless-style-dispatchers '(acdw/orderless-dispatch)) (:advise orderless-regexp :filter-args -- cgit 1.4.1-21-gabe81 From 17a5cc3f3f87f3e5c2808e13c5b6a2f32e4af9b1 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:02:09 -0500 Subject: Change widths of things --- init.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 489f278..fcf37c8 100644 --- a/init.el +++ b/init.el @@ -2011,7 +2011,7 @@ browser defined in `browse-url-secondary-browser-function'." org-src-window-setup 'current-window org-startup-truncated nil org-startup-with-inline-images t - org-tags-column (- fill-column)) + org-tags-column (- (- fill-column (length org-ellipsis)))) (:bind "RET" #'acdw-org/return-dwim "" #'acdw-org/org-table-copy-down @@ -2490,7 +2490,7 @@ If used with a numeric prefix argument N, N backticks will be inserted." (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) (setup (:straight visual-fill-column) - (:option visual-fill-column-width (+ fill-column 4) + (:option visual-fill-column-width fill-column visual-fill-column-center-text t (append reading-modes) '(visual-fill-column-mode . +1)) (:hook-into org-mode) -- cgit 1.4.1-21-gabe81 From b2eb31629e96043163f6e210b4fc8b7f72b63f16 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 17:28:30 -0500 Subject: Begin on acdw-auto-insert.el XXX It doesn't work right now --- init.el | 34 ++++++++++++++++++++++++++++++ lisp/acdw-autoinsert.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 lisp/acdw-autoinsert.el diff --git a/init.el b/init.el index fcf37c8..ac88cde 100644 --- a/init.el +++ b/init.el @@ -13,7 +13,9 @@ ;; Everyone is permitted to do whatever with this software, without ;; limitation. This software comes without any warranty whatsoever, ;; but with two pieces of advice: + ;; - Be kind to yourself. + ;; - Make good choices. ;;; Commentary: @@ -94,6 +96,38 @@ (expand-file-name-exists-p "pkg/" user-emacs-directory))) (normal-top-level-add-subdirs-to-load-path))) +(setup autoinsert + (require 'acdw-autoinsert) + (acdw/define-auto-insert '(:replace t) + ;; This is my custom auto-insert for elisp files. + '("\\.el\\'" . "Emacs Lisp header (acdw)") + '("Short description: " ";;; " + (file-name-nondirectory (buffer-file-name)) + " --- " str + (make-string (max 2 ( - 80 (current-column) 27)) 32) + "-*- lexical-binding: t; -*-" + '(setq lexical-binding t) + "\n\n;; Copyright (C) " (format-time-string "%Y") + " " (getenv "ORGANIZATION") | (progn user-full-name) + "\n\n;; Author: " (user-full-name) + '(if (search-backward "&" (line-beginning-position) t) + (replace-match (capitalize (user-login-name)) t t)) + '(end-of-line 1) + " <" (progn user-mail-address) ">" + & -2 + "\n\n;;; License:" + "\n\n;; Everyone is permitted to do whatever with this software, without" + "\n;; limitation. This software comes without any warranty whatsoever," + "\n;; but with two pieces of advice:" + "\n\n;; - Be kind to yourself." + "\n\n;; - Make good choices." + "\n\n;;; Commentary:" + "\n\n;; " _ + "\n\n;;; Code:" + "\n\n\n\n(provide '" (file-name-base (buffer-file-name)) ")" + "\n;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")) + (auto-insert-mode +1)) + (setup autorevert (:option global-auto-revert-non-file-buffers t auto-revert-verbose nil) diff --git a/lisp/acdw-autoinsert.el b/lisp/acdw-autoinsert.el new file mode 100644 index 0000000..a89bc80 --- /dev/null +++ b/lisp/acdw-autoinsert.el @@ -0,0 +1,55 @@ +;;; acdw-autoinsert.el --- autoinsert.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2021 Case Duckworth + +;; Author: Case Duckworth