From b6891017afab19ad5de0084965483ae53ee8cca3 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Fri, 5 Jun 2026 16:06:12 -0700 Subject: [PATCH] Collection of bug-fixes and tweaks Including: - Booting Spotify and Twitter - Booting icanhasshortcut for Hammerspoon - Fixes for helping to identify the line the cursor is on --- elisp/beep.el | 2 +- elisp/ha-focus.el | 4 +- ha-aux-apps.org | 15 +---- ha-capturing-notes.org | 130 +---------------------------------------- ha-config.org | 1 + ha-display.org | 34 ++++++++++- ha-org.org | 6 +- ha-theme.org | 1 + 8 files changed, 43 insertions(+), 150 deletions(-) diff --git a/elisp/beep.el b/elisp/beep.el index b02dd21..891a139 100644 --- a/elisp/beep.el +++ b/elisp/beep.el @@ -19,7 +19,7 @@ "A WAV or AU file used at the completion of a function.") ;; My replacement in case we can't play internal sounds: -(defun beep-beep () +(defun beep-beep (&rest _) "Play a default notification sound file. Customize the variable, `beep-alert-sound-file' to adjust the sound." (if (fboundp 'play-sound-internal) diff --git a/elisp/ha-focus.el b/elisp/ha-focus.el index 0185931..9d1aaa6 100644 --- a/elisp/ha-focus.el +++ b/elisp/ha-focus.el @@ -33,7 +33,7 @@ start some music to indicate we are working, and set a timer. Call `ha-focus-break' when finished." (interactive) (ha-focus-countdown-timer 25 'ha-focus-break) - (ha-focus--command "tell application \"Spotify\" to play") + (ha-focus--command "tell application \"VLC\" to play") (if (eq major-mode 'org-mode) (org-clock-in) (org-clock-in-last)) @@ -47,7 +47,7 @@ This also starts another break timer, that calls `ha-focus-break-over' when finished." (interactive) (run-with-idle-timer 30 nil 'ha-focus-capture) - (ha-focus--command "tell application \"Spotify\" to pause") + (ha-focus--command "tell application \"VLC\" to pause") (ha-focus-countdown-timer 5 'ha-focus-break-over) (message "🍅 Time to take a break.")) diff --git a/ha-aux-apps.org b/ha-aux-apps.org index 2a06ee2..642d619 100644 --- a/ha-aux-apps.org +++ b/ha-aux-apps.org @@ -26,7 +26,7 @@ A literate programming file for helper apps in Emacs. #+end_src * Introduction The following applications are not needed. I alternate between trying to /stay in Emacs/ taking advantage of the consistent interface, and using a stand-alone app on my Workday computer. -* Federation +* Social Media Apps ** Mastodon Glad to see the 2FA feature is working on the [[https://codeberg.org/martianh/mastodon.el][mastodon.el]] project, and even more glad to see the great birdland diaspora arrive in the land of the toots. #+begin_src emacs-lisp @@ -143,19 +143,6 @@ Perhaps we can make it more attractive: ement-room-timestamp-format "" ement-room-send-message-filter 'ement-room-send-org-filter)) #+end_src -* Other -** Twitter -The venerable [[https://github.com/hayamiz/twittering-mode/tree/master][twittering-mode]] allows me to follow all the twits. -#+begin_src emacs-lisp :tangle no - (use-package twittering-mode - :init - (setq twittering-use-master-password t - epa-pinentry-mode 'loopback) - :config - (defalias 'epa--decode-coding-string 'decode-coding-string) - (ha-leader "a t" '("twitter" . twit))) -#+end_src -And we are no longer using this package. ** Telega I'm thinking the [[https://zevlg.github.io/telega.el/][Telega package]] would be better than Bitlbee for Telegram communication. diff --git a/ha-capturing-notes.org b/ha-capturing-notes.org index 8e261e6..b273fed 100644 --- a/ha-capturing-notes.org +++ b/ha-capturing-notes.org @@ -244,6 +244,7 @@ I’m use [[https://github.com/deseven/icanhazshortcut][ICanHazShortcut]] to hav #+begin_src sh :shebang "#!/bin/bash" :tangle ~/bin/emacs-capture-clock /usr/bin/osascript ~/bin/emacs-capture-clock.scr #+end_src + But the following Applescript does the work: #+begin_src applescript :sheband "#!/usr/bin/osascript" :tangle ~/bin/emacs-capture-clock.scr tell application "System Events" to set theApp to name of first application process whose frontmost is true @@ -273,6 +274,7 @@ Now we have some goodies on the clipboard, and the script uses =emacsclient= to (ignore-errors (delete-frame))) #+end_src + Oh, and it this is from the Terminal program, let’s wrap it in a block: #+begin_src emacs-lisp (defun ha-external-capture-code-to-org () @@ -288,136 +290,10 @@ Oh, and it this is from the Terminal program, let’s wrap it in a block: (ignore-errors (delete-frame))) #+end_src -#+begin_src conf :tangle ~/.config/iCanHazShortcut/config.ini - [main] - config version = 2 - shell = /bin/bash -l - populate_menu_with_actions = yes - show_hotkeys_in_menu = yes - check_for_updates = yes - start_on_login = yes - show_icon_in_statusbar = yes - set_workdir_with_cd = no - window_x = -988 - window_y = 172 - window_width = 600 - window_height = 361 - shortcut_column_enabled = yes - action_column_enabled = yes - command_column_enabled = yes - workdir_column_enabled = no - shortcut_column_width = 80 - action_column_width = 160 - command_column_width = 173 - workdir_column_width = 100 - [shortcut1] - shortcut = ⇧⌃⌥⌘E - action = Personal Emacs - command = open -a Emacs - workdir = - enabled = yes - - [shortcut2] - shortcut = ⇧⌃⌥E - action = Work Emacs - command = FOR_WORK=yes open -a Emacs-Work - workdir = - enabled = yes - - [shortcut3] - shortcut = ⇧⌃⌥⌘X - action = Emacs Capture - command = ~/bin/emacs-capture - workdir = - enabled = yes - - [shortcut4] - shortcut = ⇧⌃⌥X - action = Emacs Capture Clipboard - command = ~/bin/emacs-capture-clock - workdir = - enabled = yes - - [shortcut5] - shortcut = ⇧⌃⌥T - action = iTerm - command = open -a iTerm - workdir = - enabled = yes - - [shortcut6] - shortcut = ⇧⌃⌥S - action = Slack - command = open -a Slack - workdir = - enabled = yes - - [shortcut7] - shortcut = ⇧⌃⌥W - action = Spotify - command = open -a Spotify - workdir = - enabled = yes - - [shortcut8] - shortcut = ⇧⌃⌥F - action = Firefox - command = open -a Firefox - workdir = - enabled = yes - - [shortcut9] - shortcut = ⇧⌃⌥C - action = Chome - command = ~/bin/chrome.scr - workdir = - enabled = yes - - [shortcut10] - shortcut = ⇧⌃⌥Q - action = Keepass - command = open -a KeepassXC - workdir = - enabled = yes - - [shortcut11] - shortcut = ⇧⌃⌥Z - action = Zoom - command = open -a zoom.us - workdir = - enabled = yes - - [shortcut12] - shortcut = ⌃F1 - action = Mute Zoom - command = ~/bin/zoom-muter - workdir = - enabled = yes - - [shortcut13] - shortcut = ⇧⌃⌥⌘M - action = Capture Meeting - command = ~/bin/emacs-capture-meeting - workdir = - enabled = yes - - [shortcut14] - shortcut = ⇧⌃⌥⌘B - action = Outlook - command = open -a "Microsoft Outlook" - workdir = - enabled = yes - - [shortcut15] - shortcut = ⇧⌃⌥⌘D - action = Discord - command = open -a Discord - workdir = - enabled = yes -#+end_src Configure the *ICanHazShortcut* shortcuts to call these scripts, as in this screenshot: [[file:screenshots/icanhazshortcuts.png]] + And here is the configuration file for that: #+begin_src conf :tangle ~/.config/iCanHazShortcut/config.ini :mkdirp yes [main] diff --git a/ha-config.org b/ha-config.org index 5ba4589..c8664cf 100644 --- a/ha-config.org +++ b/ha-config.org @@ -1112,6 +1112,7 @@ And some shortcut keys from the =general= project: " n" '("new space" . ha-tab-bar-new) " u" '("update names" . ha-tab-bar-update-names) " d" '("delete space" . ha-tab-bar-delete) + " t" '("toggle tab-bar" . tab-bar-mode) " w" '("special space" . ha-switch-to-special) " `" '("recent" . tab-bar-switch-to-recent-tab)) diff --git a/ha-display.org b/ha-display.org index e25dd27..1318cc1 100644 --- a/ha-display.org +++ b/ha-display.org @@ -76,8 +76,7 @@ To make the active window /more noticeable/, we /dim/ the in-active windows with As an interesting alternative, check out the [[https://www.emacs.dyerdwelling.family/emacs/20240208164549-emacs-selected-window-accent-mode-now-on-melpa/][selected-window-accent]] project. ** Ultra Scroll -The [[https://github.com/jdtsmith/ultra-scroll][ultra-scroll]] project allows smoother scrolling of text and images. While this splits text at the top/bottom of buffer windows, we no longer work within a 80x24 text matrix. Large images would -either be "there or not" which resulted large jumps and large distractions. +The [[https://github.com/jdtsmith/ultra-scroll][ultra-scroll]] project allows smoother scrolling of text and images. While this splits text at the top/bottom of buffer windows, we no longer work within a 80x24 text matrix. Large images would either be "there or not" which resulted large jumps and large distractions. #+BEGIN_SRC emacs-lisp (use-package ultra-scroll @@ -89,16 +88,45 @@ either be "there or not" which resulted large jumps and large distractions. (ultra-scroll-mode 1)) #+END_SRC ** Find the Bloody Cursor -Large screen, lots of windows, so where is the cursor? While I used to use =hl-line+=, I found that the prolific [[https://protesilaos.com/][Protesilaos Stavrou]] [[https://protesilaos.com/codelog/2022-03-14-emacs-pulsar-demo/][introduced his Pulsar project]] is just what I need. Specifically, I might /loose the cursor/ and need to have it highlighted (using ~F8~), but also, this automatically highlights the cursor line with specific /actions/ , like changing windows. +Large screen, lots of windows, so where is the cursor? While I used to use =hl-line+=, Sacha Chua’s [[https://fediscience.org/@ericsfraga/116279043710841253][suggestion]] solves the problem of the built-in =hl-line= that /highlights paragraphs/ in Org with a single function: + +#+BEGIN_SRC emacs-lisp + (defun get-visual-line-range () + "Identify current visual line (for highlighting mostly) + + Use the visual line functions to define the range in the buffer + that should be highlighted when ~hl-line-mode~ is enabled. By + default, the whole line in the file is highlighted. This is not + particularly useful in org files where I have whole paragraphs in a + single file line." + (let (b e) + (save-excursion + (beginning-of-visual-line) + (setq b (point)) + (end-of-visual-line) + (setq e (point))) + (cons b e))) + + (setq hl-line-range-function #'get-visual-line-range) + + (global-hl-line-mode 1) +#+END_SRC + +The real trick should /visually/ highlight the current line without being too light and interfering with seeing the text or being too obnoxious (see my [[file:ha-theme.org::*Dark Theme][Dark Theme]]). + +I found that the prolific [[https://protesilaos.com/][Protesilaos Stavrou]] [[https://protesilaos.com/codelog/2022-03-14-emacs-pulsar-demo/][introduced his Pulsar project]] is just what I need. Specifically, I might /loose the cursor/ and need to have it highlighted (using ~F8~), but also, this automatically highlights the cursor line with specific /actions/ , like changing windows. #+begin_src emacs-lisp (use-package pulsar :straight (:host github :repo "protesilaos/pulsar") + :after winum ace-window :custom (pulsar-face 'pulsar-generic) (pulsar-delay 0.15) :config + (set-face-attribute 'pulsar-generic nil :background "orange") + (dolist (built-in-function '(recenter-top-bottom move-to-window-line-top-bottom reposition-window bookmark-jump other-window delete-window delete-other-windows forward-page backward-page scroll-up-command scroll-down-command diff --git a/ha-org.org b/ha-org.org index 3f392c3..36723eb 100644 --- a/ha-org.org +++ b/ha-org.org @@ -3,7 +3,7 @@ #+date: 2020-09-18 #+tags: emacs org #+startup: inlineimages -#+lastmod: [2025-12-02 Tue] +#+lastmod: [2026-04-08 Wed] A literate programming file for configuring org-mode and those files. @@ -1022,8 +1022,8 @@ Next, create a configuration file, =~/.config/proselint/config= file, to turn on } #+end_src -And tell [[https://www.flycheck.org/][flycheck]] to use this: -#+begin_src emacs-lisp +And tell [[https://www.flycheck.org/][flycheck]] to use Proselint: +#+begin_src emacs-lisp :tangle no (use-package flycheck :config (add-to-list 'flycheck-checkers 'proselint) diff --git a/ha-theme.org b/ha-theme.org index c6b15d1..9566c9d 100644 --- a/ha-theme.org +++ b/ha-theme.org @@ -325,6 +325,7 @@ Let’s make a /theme/: `(window-divider ((t :foreground "black"))) `(cursor ((t (:foreground ,gray-10 :background ,cursor)))) `(region ((t (:background ,region)))) + `(hl-line ((t (:background ,gray-20)))) `(mode-line ((t (:background ,active :foreground "white")))) `(mode-line-active ((t (:background ,active))))