From 724de8e9a3b10f219c0cea4313717b287e758611 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 15 May 2023 15:05:25 -0500 Subject: Add some packages and enumerate setopts --- emacs.el | 493 +++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 288 insertions(+), 205 deletions(-) diff --git a/emacs.el b/emacs.el index d810323..4b39c26 100644 --- a/emacs.el +++ b/emacs.el @@ -22,6 +22,40 @@ ;;; Definitions: +(defun renz/sort-by-alpha-length (elems) + "Sort ELEMS first alphabetically, then by length." + (sort elems (lambda (c1 c2) + (or (string-version-lessp c1 c2) + (< (length c1) (length c2)))))) + +(defun renz/sort-by-history (elems) + "Sort ELEMS by minibuffer history. +Use `mct-sort-sort-by-alpha-length' if no history is available." + (if-let ((hist (and (not (eq minibuffer-history-variable t)) + (symbol-value minibuffer-history-variable)))) + (minibuffer--sort-by-position hist elems) + (renz/sort-by-alpha-length elems))) + +(defun renz/completion-category () + "Return completion category." + (when-let ((window (active-minibuffer-window))) + (with-current-buffer (window-buffer window) + (completion-metadata-get + (completion-metadata (buffer-substring-no-properties + (minibuffer-prompt-end) + (max (minibuffer-prompt-end) (point))) + minibuffer-completion-table + minibuffer-completion-predicate) + 'category)))) + +(defun renz/sort-multi-category (elems) + "Sort ELEMS per completion category." + (pcase (renz/completion-category) + ('nil elems) ; no sorting + ('kill-ring elems) + ('project-file (renz/sort-by-alpha-length elems)) + (_ (renz/sort-by-history elems)))) + (defun reset-faces () (dolist (face '(font-lock-regexp-face font-lock-builtin-face @@ -169,40 +203,6 @@ N spaces." (setopt tab-bar-show t) (tab-bar-mode)) -(defun renz/sort-by-alpha-length (elems) - "Sort ELEMS first alphabetically, then by length." - (sort elems (lambda (c1 c2) - (or (string-version-lessp c1 c2) - (< (length c1) (length c2)))))) - -(defun renz/sort-by-history (elems) - "Sort ELEMS by minibuffer history. -Use `mct-sort-sort-by-alpha-length' if no history is available." - (if-let ((hist (and (not (eq minibuffer-history-variable t)) - (symbol-value minibuffer-history-variable)))) - (minibuffer--sort-by-position hist elems) - (renz/sort-by-alpha-length elems))) - -(defun renz/completion-category () - "Return completion category." - (when-let ((window (active-minibuffer-window))) - (with-current-buffer (window-buffer window) - (completion-metadata-get - (completion-metadata (buffer-substring-no-properties - (minibuffer-prompt-end) - (max (minibuffer-prompt-end) (point))) - minibuffer-completion-table - minibuffer-completion-predicate) - 'category)))) - -(defun renz/sort-multi-category (elems) - "Sort ELEMS per completion category." - (pcase (renz/completion-category) - ('nil elems) ; no sorting - ('kill-ring elems) - ('project-file (renz/sort-by-alpha-length elems)) - (_ (renz/sort-by-history elems)))) - (defvar no-tabs-modes '(emacs-lisp-mode lisp-mode scheme-mode @@ -290,6 +290,17 @@ With prefix ARG, toggle the value of (put 'browse-url-browser-function 'safe-local-variable 'browse-url-browser-function-safe-p) +(defmacro comment (message &rest _ignore) + "Comment out lisp forms. +MESSAGE is for documentation purposes." + (declare (indent 1)) + t) + +(defmacro uncomment (message &rest body) + "Uncomment a commented form." + (declare (indent 1)) + `(progn ,@body)) + ;;; Packages: @@ -297,29 +308,36 @@ With prefix ARG, toggle the value of (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) -(defun ensure-package (pkg &optional localp) +(defun ensure-package (pkg &optional local require) "Esnure PKG is installed from repositories. -If LOCALP is t, add ~/src/PKG.el to `load-path'. -If LOCALP is a string, add that directory to the `load-path'." +If LOCAL is t, add ~/src/PKG.el to `load-path'. +If LOCAL is a string, add that directory to the `load-path'. +If REQUIRE is a non-nil value, require the package after adding it." (cond - ((stringp localp) - (and (file-exists-p localp) - (add-to-list 'load-path localp))) - (localp + ((stringp local) + (cond + ((file-exists-p local) + (add-to-list 'load-path local)) + (t (user-error "File does not exist: %s" local)))) + (local (ensure-package pkg (expand-file-name (format "~/src/%s.el" - (symbol-name pkg))))) + (symbol-name pkg))) + require)) (:else (unless (package-installed-p pkg) (unless (ignore-errors (package-install pkg)) (package-refresh-contents) - (package-install pkg)))))) + (package-install pkg))))) + (when require + (require pkg)) + pkg) ;; Install packages here. Acutal configuration is done in the Configuration ;; section. -(ensure-package 'consult) -(ensure-package 'marginalia) +(ensure-package 'consult nil t) +(ensure-package 'marginalia nil t) (ensure-package 'visual-fill-column) (ensure-package 'adaptive-wrap) (ensure-package 'geiser) @@ -438,9 +456,9 @@ If LOCALP is a string, add that directory to the `load-path'." (tool-bar-mode -1) -(setopt modus-themes-bold-constructs nil - modus-themes-italic-constructs t - modus-themes-variable-pitch-ui t) +(setopt modus-themes-bold-constructs nil) +(setopt modus-themes-italic-constructs t) +(setopt modus-themes-variable-pitch-ui t) (add-hook 'modus-themes-after-load-theme-hook #'reset-faces) (add-hook 'after-init-hook #'reset-faces) @@ -454,19 +472,32 @@ If LOCALP is a string, add that directory to the `load-path'." ;;; Mode line -(defvar mode-line-position - '("" - (:propertize - ("" - (:eval (if line-number-mode "%3l" "")) - (:eval (if column-number-mode - (if column-number-indicator-zero-based - "/%2c" - "/%2C") - ""))) - display (min-width (3.0))) - (:propertize (" [" (-3 "%p") "] ") - display (min-width (6.0))))) +(setq mode-line-modes + (let ((recursive-edit-help-echo + "Recursive edit, type M-C-c to get out")) + (list (propertize "%[" 'help-echo recursive-edit-help-echo) + `(:propertize ("" mode-name) + help-echo "Major mode\n\ +mouse-1: Display major mode menu\n\ +mouse-2: Show help for major mode\n\ +mouse-3: Toggle minor modes" + face bold + mouse-face mode-line-highlight + local-map ,mode-line-major-mode-keymap) + '("" mode-line-process) + `(:propertize ("" minor-mode-alist) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ +mouse-1: Display minor mode menu\n\ +mouse-2: Show help for minor mode\n\ +mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" + 'mouse-face 'mode-line-highlight + 'local-map (make-mode-line-mouse-map + 'mouse-2 #'mode-line-widen)) + (propertize "%]" 'help-echo recursive-edit-help-echo) + " "))) (setopt mode-line-format '(("%e" @@ -478,10 +509,13 @@ If LOCALP is a string, add that directory to the `load-path'." display (min-width (3.0))) " " mode-line-buffer-identification - (vc-mode (" (" (:eval (string-trim vc-mode)) ")")) + (vc-mode + (" (" (:eval (string-trim vc-mode)) ")")) " " - (mode-line-position mode-line-position) - mode-line-modes + (mode-line-position + (" - " mode-line-position)) + " - " + mode-line-modes ; the one above mode-line-misc-info mode-line-end-spaces))) @@ -494,48 +528,6 @@ If LOCALP is a string, add that directory to the `load-path'." (lambda () (setf (alist-get minor-mode minor-mode-alist) (list ""))))) -;;; Completion & minibuffer - -(fido-vertical-mode) -(minibuffer-depth-indicate-mode) - -(setopt completion-auto-help (not icomplete-mode) - completion-auto-select 'second-tab - completions-header-format nil - completions-max-height 12 - completions-format 'one-column - completion-styles '(basic partial-completion emacs22 flex) - completion-ignore-case t - read-buffer-completion-ignore-case t - read-file-name-completion-ignore-case t - completions-detailed t - enable-recursive-minibuffers t - file-name-shadow-properties '(invisible t intangible t) - minibuffer-eldef-shorten-default t - minibuffer-prompt-properties '( read-only t - cursor-intangible t - face minibuffer-prompt) - window-resize-pixelwise t - frame-resize-pixelwise t) - -(add-hook 'completion-list-mode-hook #'truncate-lines-mode) -(add-hook 'minibuffer-setup-hook #'truncate-lines-mode) - -;; Up/down when completing in the minibuffer -;; (define-key minibuffer-local-map (kbd "C-p") #'minibuffer-previous-completion) -;; (define-key minibuffer-local-map (kbd "C-n") #'minibuffer-next-completion) - -;; Up/down when competing in a normal buffer -;; (define-key completion-in-region-mode-map (kbd "C-p") #'minibuffer-previous-completion) -;; (define-key completion-in-region-mode-map (kbd "C-n") #'minibuffer-next-completion) - -(setopt completions-sort #'renz/sort-multi-category) - -(setopt tab-always-indent 'complete) - -(file-name-shadow-mode) -(minibuffer-electric-default-mode) - (scroll-bar-mode -1) (menu-bar-mode -1) @@ -567,8 +559,8 @@ If LOCALP is a string, add that directory to the `load-path'." (with-eval-after-load 'visual-fill-column - (setopt visual-fill-column-center-text t - visual-fill-column-width (+ fill-column 2)) + (setopt visual-fill-column-center-text t) + (setopt visual-fill-column-width (+ fill-column 2)) (advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)) (add-hook 'visual-line-mode-hook #'visual-fill-column-mode) (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode) @@ -583,35 +575,32 @@ If LOCALP is a string, add that directory to the `load-path'." (unless (boundp 'use-short-answers) (fset 'yes-or-no-p 'y-or-n-p)) -(setopt read-answer-short t - use-dialog-box nil - use-file-dialog nil - use-short-answers t) - +(setopt read-answer-short t) +(setopt use-dialog-box nil) +(setopt use-file-dialog nil) +(setopt use-short-answers t) (require 'savehist) -(setopt history-length 1024 - history-delete-duplicates t - ;; savehist-file (etc/ "savehist.el") - savehist-save-minibuffer-history t - savehist-autosave-interval 30) +(setopt history-length 1024) +(setopt history-delete-duplicates t) +(setopt savehist-save-minibuffer-history t) +(setopt savehist-autosave-interval 30) (savehist-mode) ;; Killing and yanking -(setopt kill-do-not-save-duplicates t - kill-read-only-ok t - ;; XXX: This setting causes an error message the first time it's - ;; called: "Selection owner couldn't convert: TIMESTAMP". I have - ;; absolutely no idea why I get this error, but it's generated in - ;; `x_get_foreign_selection'. I also can't inhibit the message or - ;; do anything else with it, so for now, I'll just live with the - ;; message. - save-interprogram-paste-before-kill t - yank-pop-change-selection t) +(setopt kill-do-not-save-duplicates t) +(setopt kill-read-only-ok t) +;; XXX: This setting causes an error message the first time it's called: +;; "Selection owner couldn't convert: TIMESTAMP". I have absolutely no idea why +;; I get this error, but it's generated in `x_get_foreign_selection'. I also +;; can't inhibit the message or do anything else with it, so for now, I'll just +;; live with the message. +(setopt save-interprogram-paste-before-kill t) +(setopt yank-pop-change-selection t) (delete-selection-mode) ;; Notifying the user -(setopt echo-keystrokes 0.01 - ring-bell-function #'ignore) +(setopt echo-keystrokes 0.01) +(setopt ring-bell-function #'ignore) ;; Point and mark (setopt set-mark-command-repeat-pop t) @@ -620,9 +609,9 @@ If LOCALP is a string, add that directory to the `load-path'." (setopt read-process-output-max (* 10 1024 1024)) ;; Startup -(setopt inhibit-startup-screen t - initial-buffer-choice t - initial-scratch-message nil) +(setopt inhibit-startup-screen t) +(setopt initial-buffer-choice t) +(setopt initial-scratch-message nil) (define-advice startup-echo-area-message (:override ()) (if (get-buffer "*Warnings*") @@ -630,26 +619,26 @@ If LOCALP is a string, add that directory to the `load-path'." "^_^")) ;; Text editing -(setopt fill-column 80 - sentence-end-double-space nil - tab-width 8 - tab-always-indent 'complete) +(setopt fill-column 80) +(setopt sentence-end-double-space nil) +(setopt tab-width 8) +(setopt tab-always-indent 'complete) (global-so-long-mode) -(setopt show-paren-delay 0.01 - show-paren-style 'parenthesis - show-paren-when-point-in-periphery t - show-paren-when-point-inside-paren t) +(setopt show-paren-delay 0.01) +(setopt show-paren-style 'parenthesis) +(setopt show-paren-when-point-in-periphery t) +(setopt show-paren-when-point-inside-paren t) (show-paren-mode) ;; Encodings (set-language-environment "UTF-8") -(setopt buffer-file-coding-system 'utf-8-unix - coding-system-for-read 'utf-8-unix - coding-system-for-write 'utf-8-unix - default-process-coding-system '(utf-8-unix . utf-8-unix) - locale-coding-system 'utf-8-unix) +(setopt buffer-file-coding-system 'utf-8-unix) +(setopt coding-system-for-read 'utf-8-unix) +(setopt coding-system-for-write 'utf-8-unix) +(setopt default-process-coding-system '(utf-8-unix . utf-8-unix)) +(setopt locale-coding-system 'utf-8-unix) (set-charset-priority 'unicode) (prefer-coding-system 'utf-8-unix) (set-default-coding-systems 'utf-8-unix) @@ -665,30 +654,30 @@ If LOCALP is a string, add that directory to the `load-path'." ;; Files -(setopt auto-revert-verbose nil - global-auto-revert-non-file-buffers t - create-lockfiles nil - find-file-visit-truename t - mode-require-final-newline t - view-read-only t - save-silently t) +(setopt auto-revert-verbose nil) +(setopt global-auto-revert-non-file-buffers t) +(setopt create-lockfiles nil) +(setopt find-file-visit-truename t) +(setopt mode-require-final-newline t) +(setopt view-read-only t) +(setopt save-silently t) (global-auto-revert-mode) -(setopt auto-save-default nil - auto-save-interval 1 - auto-save-no-message t - auto-save-timeout 1 - auto-save-visited-interval 1 - remote-file-name-inhibit-auto-save-visited t) +(setopt auto-save-default nil) +(setopt auto-save-interval 1) +(setopt auto-save-no-message t) +(setopt auto-save-timeout 1) +(setopt auto-save-visited-interval 1) +(setopt remote-file-name-inhibit-auto-save-visited t) (add-to-list 'auto-save-file-name-transforms `(".*" ,(locate-user-emacs-file "auto-save/") t)) (auto-save-visited-mode) -(setopt backup-by-copying t - version-control t - kept-new-versions 8 - kept-old-versions 8 - delete-old-versions t) +(setopt backup-by-copying t) +(setopt version-control t) +(setopt kept-new-versions 8) +(setopt kept-old-versions 8) +(setopt delete-old-versions t) (setq-default backup-directory-alist `(("^/dev/shm" . nil) ("^/tmp" . nil) @@ -696,11 +685,10 @@ If LOCALP is a string, add that directory to the `load-path'." ("." . ,(locate-user-emacs-file "backup")))) (require 'recentf) -(setopt - recentf-max-menu-items 500 - recentf-max-saved-items nil ; Save the whole list - recentf-auto-cleanup 'mode - recentf-case-fold-search t) +(setopt recentf-max-menu-items 500) +(setopt recentf-max-saved-items nil) +(setopt recentf-auto-cleanup 'mode) +(setopt recentf-case-fold-search t) ;; (add-to-list 'recentf-exclude etc/) (add-to-list 'recentf-exclude "-autoloads.el\\'") (add-hook 'buffer-list-update-hook #'recentf-track-opened-file) @@ -708,32 +696,28 @@ If LOCALP is a string, add that directory to the `load-path'." (recentf-mode) (require 'saveplace) -(setopt - save-place-forget-unreadable-files (eq system-type - 'gnu/linux)) +(setopt save-place-forget-unreadable-files (eq system-type 'gnu/linux)) (save-place-mode) (require 'uniquify) -(setq uniquify-after-kill-buffer-p t - uniquify-buffer-name-style 'forward - uniquify-ignore-buffers-re "^\\*" - uniquify-separator path-separator) +(setopt uniquify-after-kill-buffer-p t) +(setopt uniquify-buffer-name-style 'forward) +(setopt uniquify-ignore-buffers-re "^\\*") +(setopt uniquify-separator path-separator) -(setq-local vc-follow-symlinks t - vc-make-backup-files t) +(setopt vc-follow-symlinks t) +(setopt vc-make-backup-files t) ;; Whitespace (require 'whitespace) -(setopt whitespace-style - '(face trailing tabs tab-mark)) +(setopt whitespace-style '(face trailing tabs tab-mark)) (global-whitespace-mode) (add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line) ;; Native compilation -(setopt native-comp-async-report-warnings-errors 'silent - native-comp-deferred-compilation t - native-compile-target-directory - (locate-user-emacs-file "eln")) +(setopt native-comp-async-report-warnings-errors 'silent) +(setopt native-comp-deferred-compilation t) +(setopt native-compile-target-directory (locate-user-emacs-file "eln")) (when (boundp 'native-comp-eln-load-path) (add-to-list 'native-comp-eln-load-path native-compile-target-directory)) (when (fboundp 'startup-redirect-eln-cache) @@ -759,19 +743,18 @@ If LOCALP is a string, add that directory to the `load-path'." (add-to-list 'tab-bar-format 'tab-bar-format-align-right :append) (add-to-list 'tab-bar-format 'tab-bar-format-global :append) (add-to-list 'tab-bar-format 'tab-bar-end-space :append) -;;(setopt tab-bar-show t) -;;(tab-bar-mode) ; done after setting fonts ;;; Org mode (keymap-global-set "C-c a" #'org-agenda) (keymap-global-set "C-c c" #'org-capture) -(setopt org-clock-clocked-in-display 'frame-title - org-clock-frame-title-format - '("%b" " - " (t org-mode-line-string)) - org-tags-column (- (- fill-column 3)) - org-log-into-drawer t - org-clock-into-drawer t) +(setopt org-clock-clocked-in-display 'mode-line) +(setopt org-clock-string-limit 24) +(setopt org-clock-out-remove-zero-time-clocks t) +(setopt org-clock-frame-title-format '("%b" " - " (t org-mode-line-string))) +(setopt org-tags-column (- (- fill-column 3))) +(setopt org-log-into-drawer t) +(setopt org-clock-into-drawer t) ;;; Spelling @@ -953,16 +936,16 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'." (undohist-initialize) (require 'hungry-delete) -(setopt hungry-delete-chars-to-skip " \t" - hungry-delete-skip-regexp (format "[%s]" hungry-delete-chars-to-skip) - hungry-delete-join-reluctantly nil) +(setopt hungry-delete-chars-to-skip " \t") +(setopt hungry-delete-skip-regexp (format "[%s]" hungry-delete-chars-to-skip)) +(setopt hungry-delete-join-reluctantly nil) (add-to-list 'hungry-delete-except-modes 'eshell-mode) (add-to-list 'hungry-delete-except-modes 'nim-mode) (add-to-list 'hungry-delete-except-modes 'python-mode) (global-hungry-delete-mode) -(setopt avy-background t - avy-keys (string-to-list "asdfghjklqwertyuiopzxcvbnm")) +(setopt avy-background t) +(setopt avy-keys (string-to-list "asdfghjklqwertyuiopzxcvbnm")) (keymap-global-set "M-j" #'avy-goto-char-timer) (keymap-set isearch-mode-map "M-j" #'avy-isearch) (keymap-global-set "M-z" #'zzz-to-char) @@ -993,12 +976,15 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'." (keymap-set isearch-mode-map "M-s e" #'consult-isearch-history) (keymap-set isearch-mode-map "M-s l" #'consult-line) -(keymap-set minibuffer-local-map "M-n" #'consult-history) -(keymap-set minibuffer-local-map "M-p" #'consult-history) +(setopt xref-show-xrefs-function #'consult-xref) +(setopt xref-show-definitions-function #'consult-xref) -(setopt completion-in-region-function #'consult-completion-in-region - xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) +(setopt consult-preview-key "M-.") + +(consult-customize + consult-ripgrep consult-git-grep consult-grep + consult-xref + :preview-key '(:debounce 0.4 any)) (setopt initial-scratch-message ";;; Emacs!\n\n") @@ -1029,9 +1015,9 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'." (require 'anzu) (global-anzu-mode) -(setopt search-default-mode t - anzu-mode-lighter "" - anzu-deactivate-region t) +(setopt search-default-mode t) +(setopt anzu-mode-lighter "") +(setopt anzu-deactivate-region t) (global-set-key [remap query-replace] #'anzu-query-replace-regexp) (global-set-key [remap query-replace-regexp] #'anzu-query-replace) @@ -1039,3 +1025,100 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'." #'anzu-isearch-query-replace-regexp) (define-key isearch-mode-map [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace) + +;;; Completion & minibuffer + +(minibuffer-depth-indicate-mode) +(setopt tab-always-indent 'complete) +(file-name-shadow-mode) +(minibuffer-electric-default-mode) + +(setopt completion-styles '(flex basic partial-completion emacs22)) +(setopt completion-ignore-case t) +(setopt read-buffer-completion-ignore-case t) +(setopt read-file-name-completion-ignore-case t) +(setopt completions-detailed t) +(setopt enable-recursive-minibuffers t) +(setopt file-name-shadow-properties '(invisible t intangible t)) +(setopt minibuffer-eldef-shorten-default t) +(setopt minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) +(setopt window-resize-pixelwise t) +(setopt frame-resize-pixelwise t) + +(add-hook 'completion-list-mode-hook #'truncate-lines-mode) +(add-hook 'minibuffer-setup-hook #'truncate-lines-mode) + +(define-minor-mode good-completions-mode + "A mode for completing good." + :lighter "" + :global t + (setq completion-auto-help (when good-completions-mode 'always) + completion-auto-select (when good-completions-mode 'second-tab) + completions-format 'one-column + completions-header-format nil) + (cond + (good-completions-mode + ;; Turn off other completion frameworks + (icomplete-mode -1) + (icomplete-vertical-mode -1) + (fido-mode -1) + (fido-vertical-mode -1) + ;; Up/down when completing in the minibuffer + (define-key minibuffer-local-map (kbd "C-p") + #'minibuffer-previous-completion) + (define-key minibuffer-local-map (kbd "C-n") + #'minibuffer-next-completion) + ;; Up/down when competing in a normal buffer + (define-key completion-in-region-mode-map (kbd "C-p") + #'minibuffer-previous-completion) + (define-key completion-in-region-mode-map (kbd "C-n") + #'minibuffer-next-completion)) + (setq completions-sort #'renz/sort-multi-category + completion-in-region-function #'completion--in-region) + (t))) + +(good-completions-mode) + +(comment "Unnecessary after being defined." + (ensure-package 'wiki-abbrev t t) + (wiki-abbrev-insinuate)) +(add-hook 'text-mode-hook #'abbrev-mode) + +;;; Browser + +(setopt browse-url-browser-function #'eww-browse-url) + +;; External browsers: firefox > chromium > chrome +(setq browse-url-firefox-program + (or (executable-find "firefox") + (executable-find "firefox-esr")) + browse-url-firefox-new-window-is-tab t + browse-url-firefox-arguments '("--new-tab") + + browse-url-chromium-program + (or (executable-find "chromium") + (executable-find "chromium-browser")) + + browse-url-chrome-program + (or (executable-find "chrome") + (executable-find "google-chrome-stable")) + + browse-url-secondary-browser-function + (cond (browse-url-firefox-program #'browse-url-firefox) + (browse-url-chromium-program #'browse-url-chromium) + (browse-url-chrome-program #'browse-url-chrome) + (t #'browse-url-default-browser))) + +(ensure-package 'link-hint) +(setopt link-hint-avy-style 'at-full) +(setopt link-hint-avy-all-windows t) + +(defvar link-hint-map + (define-keymap + :name "Open a link" + :prefix 'link-hint-map + "M-l" #'link-hint-open-link + "M-w" #'link-hint-copy-link)) + +(keymap-global-set "M-l" 'link-hint-map) -- cgit 1.4.1-21-gabe81