From 46487b4a33e043cbeff8759b26e34ce067e96c75 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:20:14 -0500 Subject: Add find-script.el --- lisp/find-script.el | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lisp/find-script.el (limited to 'lisp') diff --git a/lisp/find-script.el b/lisp/find-script.el new file mode 100644 index 0000000..9e3633a --- /dev/null +++ b/lisp/find-script.el @@ -0,0 +1,36 @@ +;;; find-script.el --- Find a script in $PATH -*- lexical-binding: t; -*- + +;;; Commentary: + +;; This package makes it easier to find a script to edit in $PATH. The initial +;; `rehash-exes' is slow, but it's stored in `*exes*' as a caching mechanism. +;; However, I'm sure it could be improved. + +;; In addition, `*exes*' currently contains /all/ executables in $PATH, which +;; ... maybe only the ones stored in some text format should be shown. + +;;; Code: + +(defvar *exes* nil + "All the exectuables in $PATH. +Run `rehash-exes' to refresh this variable.") + +(defun rehash-exes () + "List all the executables in $PATH. +Also sets `*exes*' parameter." + (setq *exes* + (cl-loop for dir in exec-path + append (file-expand-wildcards (concat dir "*")) + into exes + finally return exes))) + +;;;###autoload +(defun find-script (script) + "Find a file in $PATH." + (interactive + (list (let ((exes (or *exes* (rehash-exes)))) + (completing-read "Script> " exes nil t)))) + (find-file script)) + +(provide 'find-script) +;;; find-script.el ends here -- cgit 1.4.1-21-gabe81 From bcf56eff2122f582fb4116b7c00f7754d94bbad7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:20:36 -0500 Subject: Remove redundancy --- early-init.el | 2 +- lisp/+setup.el | 45 +-------------------------------------------- 2 files changed, 2 insertions(+), 45 deletions(-) (limited to 'lisp') diff --git a/early-init.el b/early-init.el index d2097b3..0f729c8 100644 --- a/early-init.el +++ b/early-init.el @@ -140,7 +140,7 @@ See `no-littering' for examples.") ;; Setup `setup' -(add-to-list 'setup-modifier-list 'setup-wrap-to-demote-errors) +(add-to-list 'setup-modifier-list '+setup-wrap-to-demote-errors) (unless (memq debug-on-error '(nil init)) (define-advice setup (:around (fn head &rest args) +setup-report) (+with-progress ((format "[Setup] %S..." head)) diff --git a/lisp/+setup.el b/lisp/+setup.el index db59223..194baa8 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el @@ -88,50 +88,7 @@ If PATH does not exist, abort the evaluation." ',recipe) ,(setup-quit)) (:success t))) -(defun setup--straight-handle-arg (arg var) - (cond - ((and (boundp var) (symbol-value var)) t) - ((keywordp arg) (set var t)) - ((functionp arg) (set var nil) (funcall arg)) - ((listp arg) (set var nil) (eval arg :lexical)))) - -(setup-define :straight - (lambda (recipe &rest predicates) - (let* ((skp (make-symbol "straight-keyword-p")) - (straight-use-p - (cl-every (lambda (f) (setup--straight-handle-arg f skp)) - predicates)) - (form `(unless (and ,straight-use-p - (condition-case e - (straight-use-package ',recipe) - (error - (+setup-warn ":straight error: %S" - ',recipe) - ,(setup-quit)) - (:success t))) - ,(setup-quit)))) - ;; Keyword arguments --- :quit is special and should short-circuit - (if (memq :quit predicates) - (setq form `,(setup-quit)) - ;; Otherwise, handle the rest of them ... - (when-let ((after (cadr (memq :after predicates)))) - (setq form `(with-eval-after-load ,(if (eq after t) - (setup-get 'feature) - after) - ,form)))) - ;; Finally ... - form)) - :documentation "Install RECIPE with `straight-use-package'. -If PREDICATES are given, only install RECIPE if all of them return non-nil. -The following keyword arguments are also recognized: -- :quit --- immediately stop evaluating. Good for commenting. -- :after FEATURE --- only install RECIPE after FEATURE is loaded. - If FEATURE is t, install RECIPE after the current feature." - :repeatable nil - :indent 1 - :shorthand (lambda (sexp) - (let ((recipe (cadr sexp))) - (or (car-safe recipe) recipe)))) ,(setup-quit)))) + ,(setup-quit)))) ;; Keyword arguments --- :quit is special and should short-circuit (if (memq :quit predicates) (setq form `,(setup-quit)) -- cgit 1.4.1-21-gabe81 From 144e5244d2076eac0e0216a0b09f39a21a9c8dbf Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:20:46 -0500 Subject: Demote errors more better-er --- lisp/+setup.el | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'lisp') diff --git a/lisp/+setup.el b/lisp/+setup.el index 194baa8..d5a3a77 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el @@ -29,23 +29,37 @@ "Warn the user that something bad happened in `setup'." (display-warning 'setup (format message args))) +(defun +setup-wrap-to-demote-errors (body name) + "Wrap BODY in a `with-demoted-errors' block. +This behavior is prevented if `setup-attributes' contains the +symbol `without-error-demotion'. + +This function differs from `setup-wrap-to-demote-errors' in that +it includes the NAME of the setup form in the warning output." + (if (memq 'without-error-demotion setup-attributes) + body + `(with-demoted-errors ,(format "Error in setup form on line %d (%s): %%S" + (line-number-at-pos) + name) + ,body))) + (setup-define :quit 'setup-quit :documentation "Quit the current `setup' form. Good for commenting.") (setup-define :face - (lambda (face spec) - `(custom-set-faces (list ,face ,spec 'now "Customized by `setup'."))) + (lambda (face spec) + `(custom-set-faces (list ,face ,spec 'now "Customized by `setup'."))) :documentation "Customize FACE with SPEC using `custom-set-faces'." :repeatable t) (setup-define :load-after - (lambda (&rest features) - (let ((body `(require ',(setup-get 'feature)))) - (dolist (feature (nreverse features)) - (setq body `(with-eval-after-load ',feature ,body))) - body)) + (lambda (&rest features) + (let ((body `(require ',(setup-get 'feature)))) + (dolist (feature (nreverse features)) + (setq body `(with-eval-after-load ',feature ,body))) + body)) :documentation "Load the current feature after FEATURES.") (setup-define :load-from -- cgit 1.4.1-21-gabe81 From a8e71fa8c7be3840ce7063e3c09dc51f7119308c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:21:02 -0500 Subject: Add straight :needs --- lisp/+setup.el | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lisp') diff --git a/lisp/+setup.el b/lisp/+setup.el index d5a3a77..919e312 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el @@ -126,6 +126,13 @@ The following keyword arguments are also recognized: (let ((recipe (cadr sexp))) (or (car-safe recipe) recipe))))) +(setup-define :needs + (lambda (executable) + `(unless (executable-find ,executable) + ,(setup-quit))) + :documentation "If EXECUTABLE is not in the path, stop here." + :repeatable 1) + ;;; Redefines of `setup' forms -- cgit 1.4.1-21-gabe81 From e3356d3c39eb59c9a80ac152dcd1615aadeea962 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:21:12 -0500 Subject: Pull recipe repos as part of +straight-update-all --- lisp/+straight.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp') diff --git a/lisp/+straight.el b/lisp/+straight.el index d00ad9a..cba6c96 100644 --- a/lisp/+straight.el +++ b/lisp/+straight.el @@ -34,6 +34,7 @@ all of them, for reasons that should be obvious. With a prefix argument, it also pulls the packages FROM-UPSTREAM." (interactive "P") + (straight-pull-recipe-repositories) (straight-pull-all from-upstream) (straight-rebuild-all)) -- cgit 1.4.1-21-gabe81 From 246990fd15c85c26d262ffe4587e739d21a36004 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:21:32 -0500 Subject: Make modes in which to ignore open-paragraph a customization option --- lisp/acdw.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/acdw.el b/lisp/acdw.el index a673e4a..10a51c1 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -139,6 +139,10 @@ active, or else the entire buffer." (= (line-beginning-position) (line-end-position))) (insert "\n"))))) +(defcustom +open-paragraph-ignore-modes '(special-mode lui-mode comint-mode) + "Modes in which `+open-paragraph' makes no sense." + :type '(repeat function)) + (defun +open-paragraph (&optional arg) "Open a paragraph after paragraph at point. A paragraph is defined as continguous non-empty lines of text @@ -149,7 +153,7 @@ Called with prefix ARG, open a paragraph before point." ;; TODO: Take an integer as ARG, allowing for skipping paragraphs up and down. (interactive "*P") ;; TODO: add `+open-paragraph-ignore-modes' - (unless (derived-mode-p 'special-mode 'lui-mode 'comint-mode) + (unless (apply #'derived-mode-p +open-paragraph-ignore-modes) ;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because ;; that's weird with org, and I'm guessing other modes too. (unless (looking-at "^$") (forward-line (if arg -1 +1))) -- cgit 1.4.1-21-gabe81 From 1df15735b2fe65cf59ef9d3d84ad3175e35cb682 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:21:51 -0500 Subject: Add +sort-lines --- lisp/acdw.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lisp') diff --git a/lisp/acdw.el b/lisp/acdw.el index 10a51c1..171a109 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -431,5 +431,22 @@ This calls `indent-rigidly' and passes ARG to it." (goto-char (line-end-position))) (call-interactively #'indent-rigidly)) +(defun +sort-lines (reverse beg end) + "Sort lines in region, ignoring leading whitespace. +REVERSE non-nil means descending order; interactively, REVERSE is +the prefix argument, and BEG and END are the region. The +variable `sort-fold-case' determines whether case affects the +sort order." + (interactive "P\nr") + (save-excursion + (save-restriction + (narrow-to-region beg end) + (goto-char (point-min)) + (let ((inhibit-field-text-motion t)) + (sort-subr reverse + #'forward-line + #'end-of-line + #'beginning-of-line-text))))) + (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81 From fcd47a9c3a10b6028045773ff5b197a080ac345c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 10:23:02 -0500 Subject: meh --- init.el | 121 ++++++++++++++++++++++++++++++++++++---------------- lisp/+browse-url.el | 6 +-- lisp/+consult.el | 2 +- lisp/+dired.el | 23 +++++----- lisp/+init.el | 9 ++-- lisp/+jabber.el | 12 ++++++ lisp/+key.el | 6 +-- lisp/+org.el | 13 ------ 8 files changed, 119 insertions(+), 73 deletions(-) (limited to 'lisp') diff --git a/init.el b/init.el index 4c0c4b0..206ba45 100644 --- a/init.el +++ b/init.el @@ -14,6 +14,14 @@ ;; - Be kind to yourself. ;; - Make good choices. +;;; Commentary + +;; My init.el. There are many like it, but this one is mine. + +;; Ideas: +;; [[https://emacs.stackexchange.com/questions/17278/truncate-only-certain-lines-and-use-continuation-lines-elsewhere][Truncate org-mode headings]] +;; [[https://emacs.stackexchange.com/questions/7432/make-visual-line-mode-more-compatible-with-org-mode][another link that might be useful for truncating]] + ;;; Code: (let ((early-features `((early-init . ,(locate-user-emacs-file "early-init")) @@ -104,6 +112,8 @@ (:with-mode Custom-mode (:local-set imenu-generic-expression +cus-edit-imenu-generic-expression))) +(setup (:require find-script)) + (setup (:require goto-addr) (if (fboundp #'global-goto-address-mode) (global-goto-address-mode) @@ -242,17 +252,15 @@ (:option +browse-url-transformations `((,(rx (or "youtube.com" "youtu.be")) . ,+invidious-host) - ("twitter\\.com" - . "nitter.net") - ("instagram\\.com" - . "bibilogram.art") + ("twitter\\.com" . "nitter.net") + ("instagram\\.com" . "bibilogram.art") (,(rx (or "reddit.com" "old.reddit.com")) . "teddit.net") - ("medium\\.com" - . "scribe.rip") - ("www\\.npr\\.org" - . "text.npr.org"))) + ("medium\\.com" . "scribe.rip") + ("www\\.npr\\.org" . "text.npr.org") + ;;TODO: Various paste sites + )) (+browse-url-transform-url-global-mode +1)) (setup calendar @@ -458,7 +466,8 @@ '(context-menu-ffap context-menu-region context-menu-undo - context-menu-dictionary)) + ;; context-menu-dictionary + )) (context-menu-mode +1)) (dolist (click '(;; Fix scrolling in the margin wheel-down double-wheel-down triple-wheel-down @@ -467,9 +476,25 @@ (global-set-key (vector 'left-margin click) 'mwheel-scroll))) (setup net-utils + (:needs "traceroute") (:require +finger) ; fixes `finger' to use var below (:option finger-X.500-host-regexps '(".") ; only send username - )) + ) + (require 'transient) + (transient-define-prefix net-utils () + "Networking utilities" + ["Actions" + ("p" "Ping" ping) + ("i" "Ifconfig" ifconfig) + ("w" "Iwconfig" iwconfig) + ("n" "Netstat" netstat) + ("a" "Arp" arp) + ("r" "Route" route) + ("h" "Nslookup host" nslookup-host) + ("d" "Dig" dig) + ("s" "Smb Client" smbclient) + ("t" "Traceroute" traceroute)]) + (:+key "C-z M-n" #'net-utils)) (setup notmuch (:load-from "~/usr/share/emacs/site-lisp/") @@ -558,7 +583,7 @@ org-fontify-done-headline t org-fontify-quote-and-verse-blocks t org-fontify-whole-heading-line t - org-hide-emphasis-markers t + org-hide-emphasis-markers nil org-html-coding-system 'utf-8-unix org-image-actual-width (list (* (window-font-width) (- fill-column 8))) @@ -617,7 +642,15 @@ "C-c C-p" #'+org-previous-heading-widen "C-c C-o" #'+org-open-at-point-dwim "`" #'+org-insert-tilde - "~" #'+org-insert-backtick) + "~" #'+org-insert-backtick + "C-c C-x l" #'org-toggle-link-display + "C-c C-x m" (lambda () (interactive) + (setq-local org-hide-emphasis-markers + (not org-hide-emphasis-markers)) + (font-lock-update)) + "C-c C-x r" #'+org-drawer-list-add-resource + "C-M-k" #'kill-paragraph + "C-M-t" #'transpose-paragraphs) (:global [f8] #'org-clock-in [f9] #'org-clock-out "C-c l" #'org-store-link) @@ -629,6 +662,12 @@ (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) ("SCHEDULED:" . ?↷) ("CLOSED:" . ?✓)) + ;; electric-pair-pairs + ;; (append electric-pair-pairs + ;; (mapcar (lambda (emph) + ;; (let ((ch (string-to-char (car emph)))) + ;; (cons ch ch))) + ;; org-emphasis-alist)) ;;+modeline-position-function #'+org-count-words-stupidly ) (:local-hook user-save-hook #'+org-before-save@prettify-buffer) @@ -646,6 +685,9 @@ (org-link-set-parameters "sms" :follow #'+org-sms-open) (setf (alist-get "\\.x?html?\\'" org-file-apps nil nil #'equal) #'+org-open-html)) + (:face 'org-done '((t (:inherit (modus-themes-subtle-green)))) + 'org-tag '((t (:inherit (secondary-selection)))) + 'org-todo '((t (:inherit (modus-themes-subtle-red))))) ;; Extra keywords (font-lock-add-keywords 'org-mode @@ -1158,10 +1200,6 @@ (:hook #'visual-line-mode #'enable-lui-track #'visual-fill-column-mode - (defun +disable-electric-pair-mode () - "Disable `electric-pair-mode' in the current buffer." - (interactive) - (electric-pair-local-mode -1)) #'enable-lui-autopaste) (:local-set fringes-outside-margins t right-margin-width (length lui-time-stamp-format) @@ -1178,6 +1216,7 @@ (setf (alist-get 'lui-next-button-or-complete vertico-multiform-commands) '(flat)))) + (tracking-mode +1) (:with-mode tracking-mode (:option tracking-position 'before-modes) (:bind "C-c C-SPC" (lambda () (interactive) @@ -1295,19 +1334,20 @@ (with-eval-after-load 'vertico-multiform (setf (alist-get 'consult-buffer vertico-multiform-commands) '(flat)) (dolist (buf-cmd '(consult-find - consult-yank-pop - consult-locate - consult-grep + consult-flymake + consult-focus-lines consult-git-grep - consult-ripgrep + consult-grep + consult-imenu + consult-imenu-multi + consult-keep-lines consult-line consult-line-multi + consult-locate consult-multi-occur - consult-keep-lines - consult-focus-lines - consult-imenu - consult-imenu-multi - consult-outline)) + consult-outline + consult-ripgrep + consult-yank-pop)) (setf (alist-get buf-cmd vertico-multiform-commands) nil))))) (setup (:straight consult-dir) @@ -1505,6 +1545,11 @@ (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) (setup (:straight embrace) + (dolist (mode '(LaTeX-mode org-mode ruby-mode)) + (add-hook (intern (format "%s-hook" mode)) + (intern (format "embrace-%s-hook" mode)))) + (:face 'embrace-help-pair-face '((t ( :inverse-video nil + :inherit font-lock-keyword-face)))) (:+key "C-," #'embrace-commander)) (setup (:straight (ement @@ -1611,7 +1656,7 @@ (setup (:straight (forge :host github :repo "magit/forge") (eq system-type 'gnu/linux)) - (require 'forge) + (:quit) ; XXX: Somehow missing compat-26 (add-to-list 'forge-alist '("tildegit.org" "tildegit.org/api/v1" "tildegit.org" forge-gitea-repository))) @@ -1624,6 +1669,7 @@ (setup (:straight (frowny :host github :repo "duckwork/frowny.el")) + (:option frowny-eyes (rx (any ":=") (opt "'") (? "-"))) (global-frowny-mode +1)) (setup (:straight gcmh) @@ -1749,9 +1795,6 @@ :fork ( :host nil :repo "https://codeberg.org/acdw/emacs-jabber"))) (:also-load +jabber) - (defvar +jabber-ws-prefix 0 "Width to pad left side of chats.") - (defvar +jabber-pre-prompt " \n" - "String to show before a prompt.") (:option jabber-account-list '(("acdw@hmm.st")) jabber-groupchat-buffer-format "%n" jabber-chat-buffer-format "%n" @@ -1760,7 +1803,7 @@ jabber-muc-decorate-presence-patterns '(("\\( enters the room ([^)]+)\\| has left the chatroom\\)$") ("." . jabber-muc-presence-dim)) - jabber-muc-colorize-foreign t + jabber-muc-colorize-foreign nil ; colorizing doesn't match my color theme jabber-chat-foreign-prompt-format (concat +jabber-pre-prompt "[%t] %n\n" (make-string +jabber-ws-prefix @@ -1794,7 +1837,6 @@ jabber-console-mode)) (let ((hook (intern (format "%s-hook" mode)))) (add-hook hook #'visual-fill-column-mode))) - (add-hook 'jabber-activity-mode-hook #'tracking-mode) (with-eval-after-load 'tracking (add-to-list 'tracking-ignored-buffers "discuss@conference.soprani.ca")) (:with-mode jabber-chat-mode @@ -1888,6 +1930,7 @@ (setup (:straight mastodon) (:option mastodon-instance-url "https://tiny.tilde.website" + mastodon-active-user "acdw" mastodon-client--token-file (.etc "mastodon.plstore") mastodon-auth-source-file (seq-some (lambda (i) (when (and (stringp i) @@ -2016,7 +2059,7 @@ (:option completion-styles '(substring orderless basic) completion-category-defaults nil completion-category-overrides - '((file (styles partial-completion)) + '((file (styles basic partial-completion)) (command (styles +orderless-with-initialism)) (variable (styles +orderless-with-initialism)) (symbol (styles +orderless-with-initialism))) @@ -2056,6 +2099,7 @@ (local-set-key (kbd "C-c M-o") 'org-mime-org-buffer-htmlize)))) (setup (:straight org-modern) + (:quit "I think I can do most of this myself.") (:option org-modern-hide-stars nil org-modern-star nil org-modern-list nil @@ -2081,7 +2125,9 @@ (org-visibility-enable-hooks)) (setup (:straight orglink) - (global-orglink-mode +1)) + (:option orglink-activate-in-modes '(text-mode prog-mode)) + (global-orglink-mode +1) + (global-goto-address-mode -1)) (setup (:straight package-lint)) @@ -2126,7 +2172,7 @@ (executable-find "g++"))) (setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal) #'pdf-view-mode) - (pdf-tools-install)) + (pdf-tools-install t)) (setup (:straight (plancat :host github @@ -2210,6 +2256,8 @@ (:also-load +slack) (:option slack-prefer-current-team t slack-buffer-emojify t + slack-thread-also-send-to-room nil + slack-typing-visibility 'buffer slack-buffer-create-on-notify t slack-enable-wysiwyg t slack-file-dir (xdg-user-dir "DOWNLOAD") @@ -2243,7 +2291,8 @@ (sophomore-enable #'narrow-to-region) (sophomore-disable ; These are mostly annoying commands #'view-hello-file - #'describe-gnu-project) + #'describe-gnu-project + #'suspend-frame) (sophomore-mode +1)) (setup (:straight ssh-config-mode) @@ -2257,7 +2306,7 @@ (setup (:straight super-save) (:option auto-save-default nil super-save-auto-save-when-idle t - super-save-idle-duration 60 + super-save-idle-duration 30 super-save-exclude '(".gpg") super-save-remote-files nil) (auto-save-visited-mode -1) diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index dbbfef2..fc479e4 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el @@ -120,9 +120,9 @@ ARGS are ignored here, but passed on for later processing." ;; along with the rest of the args, in a list to the original caller (probably ;; `browse-url'.) (apply 'list - (cl-loop with url = (substring-no-properties - (if (consp url) (car url) url)) - for (regex . transformation) in +browse-url-transformations + (cl-loop with url = (substring-no-properties + (if (consp url) (car url) url)) + for (regex . transformation) in +browse-url-transformations if (string-match regex url) return (replace-match transformation nil nil url) ;; else diff --git a/lisp/+consult.el b/lisp/+consult.el index dc06ad5..21c2565 100644 --- a/lisp/+consult.el +++ b/lisp/+consult.el @@ -5,7 +5,7 @@ (defun +consult-project-root () "Return either the current project, or the VC root, of current file." (if (and (functionp 'project-current) - (project-current)) + (project-current)) (car (project-roots (project-current))) (vc-root-dir))) diff --git a/lisp/+dired.el b/lisp/+dired.el index 9a2e01a..2e42c19 100644 --- a/lisp/+dired.el +++ b/lisp/+dired.el @@ -2,18 +2,17 @@ ;;; Code: -(require 'vertico) - -(defun +dired-goto-file (file) - "ADVICE for `dired-goto-file' to make RET call `vertico-exit'." - (interactive ; stolen from `dired-goto-file' - (prog1 - (list (dlet ((vertico-map (copy-keymap vertico-map))) - (define-key vertico-map (kbd "RET") #'vertico-exit) - (expand-file-name (read-file-name "Goto file: " - (dired-current-directory))))) - (push-mark))) - (dired-goto-file file)) +(with-eval-after-load 'vertico + (defun +dired-goto-file (file) + "ADVICE for `dired-goto-file' to make RET call `vertico-exit'." + (interactive ; stolen from `dired-goto-file' + (prog1 + (list (dlet ((vertico-map (copy-keymap vertico-map))) + (define-key vertico-map (kbd "RET") #'vertico-exit) + (expand-file-name (read-file-name "Goto file: " + (dired-current-directory))))) + (push-mark))) + (dired-goto-file file))) ;;; [[https://www.reddit.com/r/emacs/comments/u2lf9t/weekly_tips_tricks_c_thread/i4n9aoa/?context=3][Dim files in .gitignore]] diff --git a/lisp/+init.el b/lisp/+init.el index 8f999f9..a3f680b 100644 --- a/lisp/+init.el +++ b/lisp/+init.el @@ -72,11 +72,10 @@ are sorted lexigraphically." ;; otherwise, sort lexigraphically (t (string< s1 s2))))))))) ;; Return to original point relative to the defun we were in - (goto-char (point-min)) - (re-search-forward current-defun-re) - (beginning-of-defun) - (goto-char (+ (point) defun-point)) - )) + (ignore-errors (goto-char (point-min)) + (re-search-forward current-defun-re) + (beginning-of-defun) + (goto-char (+ (point) defun-point))))) (defun +init-sort-then-save () "Sort init.el, then save it." diff --git a/lisp/+jabber.el b/lisp/+jabber.el index c5d568c..e018b0c 100644 --- a/lisp/+jabber.el +++ b/lisp/+jabber.el @@ -10,6 +10,18 @@ (require 'jabber) (require 'tracking) +(defgroup +jabber nil + "Extra jabber.el customizations." + :group 'jabber) + +(defcustom +jabber-ws-prefix 0 + "Width to pad left side of chats." + :type 'string) + +(defcustom +jabber-pre-prompt " \n" + "String to put before the prompt." + :type 'string) + (defvar +jabber-tracking-show-p #'jabber-activity-show-p-default "Function that checks if the given JID should be shown in the mode line. This does the same as `jabber-activity-show-p', but for the diff --git a/lisp/+key.el b/lisp/+key.el index ad3b215..a217dad 100644 --- a/lisp/+key.el +++ b/lisp/+key.el @@ -19,9 +19,9 @@ ;; I need to define this map before the proper mode map. (defvar +key-leader-map (let ((map (make-sparse-keymap)) - (c-z (global-key-binding "\C-z"))) - (define-key map "\C-z" c-z) - map) + (c-z (global-key-binding "\C-z"))) + ;;(define-key map "\C-z" c-z) + map) "A leader keymap under the \"C-z\" bind.") ;; http://xahlee.info/emacs/emacs/emacs_menu_app_keys.html and diff --git a/lisp/+org.el b/lisp/+org.el index 252ee55..6075b60 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -588,19 +588,6 @@ and POST-PROCESS are passed to `org-export-to-file'." ("—" "---")))) (replace-match replace nil nil))))) -;;; Toggle org-hide-emphasis-markers - -(define-minor-mode +org-show-mode - "Show emphasis markers and full links in `org-mode'." - :lighter "/*/" - (setq org-hide-emphasis-markers (not +org-show-mode) - org-link-descriptive (not +org-show-mode)) - (funcall (if +org-show-mode - #'remove-from-invisibility-spec - #'add-to-invisibility-spec) - '(org-link)) - (font-lock-update)) - ;;; go forward and backward in the tree, ~ cleanly ~ ;; https://stackoverflow.com/a/25201697/10756297 -- cgit 1.4.1-21-gabe81 From 222a20c7c1cc93e8eb4efc71505ca1ce3313ed3c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 13:16:16 -0500 Subject: Further modeline changes --- init.el | 4 +--- lisp/+modeline.el | 35 ++++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'lisp') diff --git a/init.el b/init.el index 569afa4..8ad68b3 100644 --- a/init.el +++ b/init.el @@ -2257,9 +2257,7 @@ ",") +modeline-input-method +modeline-position - ,(+modeline-concat - '(+modeline-minions - +modeline-major-mode)) + +modeline-major-mode +modeline-file-percentage ))) (simple-modeline-mode +1)) diff --git a/lisp/+modeline.el b/lisp/+modeline.el index e5b5bc6..df9d504 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -126,9 +126,18 @@ and appended with `truncate-string-ellipsis'." (propertize ;; (+string-truncate (format-mode-line mode-name) 16) (format-mode-line mode-name) 'face 'font-lock-keyword-face - 'keymap mode-line-major-mode-keymap - 'help-echo (concat (format-mode-line mode-name) - " mode\nmouse-1: show menu.") + 'keymap (let ((map (make-sparse-keymap))) + (bindings--define-key map [mode-line down-mouse-1] + `(menu-item "Menu Bar" ignore + :filter ,(lambda (_) (mouse-menu-major-mode-map)))) + (define-key map [mode-line mouse-2] 'describe-mode) + (bindings--define-key map [mode-line down-mouse-3] + `(menu-item "Minions" minions-minor-modes-menu)) + map) + 'help-echo (+concat (list (format-mode-line mode-name) " mode") + "mouse-1: show menu" + "mouse-2: describe mode" + "mouse-3: display minor modes") 'mouse-face 'mode-line-highlight))) (defcustom +modeline-modified-icon-alist '((ephemeral . "*") @@ -302,9 +311,10 @@ The order of elements matters: whichever one matches first is applied." (defun +modeline-line-column (&optional spacer) ; adapted from `simple-modeline' "Display the current cursor line and column depending on modes." - (funcall (+modeline-concat '(+modeline-line - +modeline-column) - "|"))) + (concat (or spacer +modeline-default-spacer) + (+modeline-line "") + "|" + (+modeline-column ""))) (defcustom +modeline-position-function nil "Function to use instead of `+modeline-position' in modeline." @@ -312,17 +322,16 @@ The order of elements matters: whichever one matches first is applied." function) :local t) -(defun +modeline-position (&optional _) +(defun +modeline-position (&optional spacer) "Display the current cursor position. See `line-number-mode', `column-number-mode', and `file-percentage-mode'. If `+modeline-position-function' is set to a function in the current buffer, call that function instead." - (funcall (if +modeline-position-function - +modeline-position-function - (+modeline-concat '(+modeline-region - +modeline-line-column - ;; +modeline-file-percentage - ))))) + (concat (or spacer +modeline-default-spacer) + (if +modeline-position-function + (funcall +modeline-position-function) + (concat (+modeline-region) + (+modeline-line-column))))) (defun +modeline-vc (&optional spacer) "Display the version control branch of the current buffer in the modeline." -- cgit 1.4.1-21-gabe81