New Mac system shook out some MacOS changes needing incorporation
Specifically how Homebrew is installing its goodies in a different location, which makes it a bit incompatible with my Linux boxen.
This commit is contained in:
parent
0bda2f1dab
commit
6e92e3d13d
9 changed files with 78 additions and 35 deletions
|
@ -75,6 +75,26 @@ And if that doesn’t work, then we need to delete all packages installed by bre
|
|||
|
||||
echo "Good luck rebuilding Emacs."
|
||||
#+end_src
|
||||
* Afterwards
|
||||
After Emacs is /kinda/ working, make sure you install *all* the fonts, that is:
|
||||
#+begin_example
|
||||
M-x all-the-icons-install-fonts
|
||||
#+end_example
|
||||
And to get the Doom Modeline working:
|
||||
#+begin_example
|
||||
M-x nerd-icons-install-fonts
|
||||
#+end_example
|
||||
|
||||
Everything golden?
|
||||
#+begin_example
|
||||
M-x straight-freeze-versions
|
||||
#+end_example
|
||||
|
||||
Before we can build a Telegram server for [[file:ha-aux-apps.org::*Telega][Telega]], we need to install the /latest/ version:
|
||||
#+begin_src sh
|
||||
brew unlink tdlib # optional
|
||||
brew install tdlib --HEAD
|
||||
#+end_src
|
||||
* Supporting Packages
|
||||
Now install all the extras:
|
||||
#+begin_src sh
|
||||
|
@ -228,7 +248,7 @@ Script that fetches mails and updates the mail index.
|
|||
* Emacsclient
|
||||
Simple /Automator/ script that's wrapped into an application and placed in the =Applications= folder. Select *New Document*, then select *Application*. Open the *Library*, and drag the *Run Shell Script* to the /workflow/. In the box, add this:
|
||||
#+begin_src sh
|
||||
/usr/local/bin/emacsclient -nc --socket-name work $*
|
||||
/opt/homebrew/bin/emacsclient -nc --socket-name work $*
|
||||
#+end_src
|
||||
Change the *Pass Input* to =as arguments=.
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ Clear up a Mac-specific issue that sometimes arises since I'm switching to [[htt
|
|||
#+begin_src emacs-lisp
|
||||
(when (ha-running-on-macos?)
|
||||
(add-to-list 'exec-path "/usr/local/bin")
|
||||
(add-to-list 'exec-path "/opt/homebrew/bin")
|
||||
(add-to-list 'exec-path (concat invocation-directory "bin") t))
|
||||
#+end_src
|
||||
|
||||
|
@ -85,7 +86,7 @@ On Linux, GPG is pretty straight-forward, but on the Mac, I often have troubles
|
|||
#+end_src
|
||||
Next, on every reboot, start the agent:
|
||||
#+begin_src sh
|
||||
/usr/local/Cellar/gnupg/2.3.6/bin/gpg-agent --daemon
|
||||
/opt/homebrew/bin/gpg-agent --daemon
|
||||
#+end_src
|
||||
|
||||
Since =brew link gpg= doesn’t always work, this helper function may find the executable:
|
||||
|
@ -97,7 +98,7 @@ Since =brew link gpg= doesn’t always work, this helper function may find the e
|
|||
|
||||
(use-package epa-file
|
||||
:straight (:type built-in)
|
||||
:custom (epg-gpg-program (or (executable "/usr/local/Cellar/gnupg/*/bin/gpg")
|
||||
:custom (epg-gpg-program (or (executable "/opt/homebrew/bin/gpg")
|
||||
(executable "/usr/local/bin/gpg")
|
||||
(executable "/usr/local/opt/gpg")
|
||||
(executable "/usr/bin/pgp")))
|
||||
|
|
|
@ -245,12 +245,12 @@ While the space can be use to separate words (acting a bit like a =.*= regular e
|
|||
#+begin_src emacs-lisp
|
||||
(use-package orderless
|
||||
:commands (orderless-filter)
|
||||
:config
|
||||
(push 'orderless completion-styles)
|
||||
:custom
|
||||
(completion-ignore-case t)
|
||||
(completion-category-defaults nil)
|
||||
(completion-category-overrides '((file (styles partial-completion)))))
|
||||
(completion-category-overrides '((file (styles partial-completion))))
|
||||
:init
|
||||
(push 'orderless completion-styles))
|
||||
#+end_src
|
||||
*Note:* Open more than one file at once with =find-file= with a wildcard. We may also give the =initials= completion style a try.
|
||||
*** Fussy Filtering and Matching
|
||||
|
@ -260,7 +260,7 @@ How does it compare? Once upon a time, I enjoyed typing ~plp~ for =package-list-
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package fussy
|
||||
:straight (:host github :repo "jojojames/fussy")
|
||||
;; :straight (:host github :repo "jojojames/fussy")
|
||||
:config
|
||||
(push 'fussy completion-styles)
|
||||
(setq completion-category-defaults nil
|
||||
|
@ -809,7 +809,7 @@ With these helper functions in place, I can create a leader collection for file-
|
|||
On Unix systems, the =locate= command is faster than =find= when searching the whole system, since it uses a pre-computed database, and =find= is faster if you need to search a specific directory instead of the whole system. On the Mac, we need to change the =locate= command:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(when (equal system-type 'darwin)
|
||||
(when (ha-running-on-macos?)
|
||||
(setq locate-command "mdfind"))
|
||||
#+end_src
|
||||
|
||||
|
@ -2118,7 +2118,7 @@ Can not live without [[https://magit.vc/][Magit]], a Git porcelain for Emacs. I
|
|||
#+begin_src emacs-lisp
|
||||
(use-package magit
|
||||
;; See https://github.com/magit/magit/wiki/Emacsclient for why we need to set:
|
||||
:custom (with-editor-emacsclient-executable "/usr/local/bin/emacsclient")
|
||||
:custom (with-editor-emacsclient-executable "emacsclient")
|
||||
|
||||
:config
|
||||
;; The following code re-instates my General Leader key in Magit.
|
||||
|
@ -2708,7 +2708,9 @@ Why not [[https://github.com/politza/pdf-tools][view PDF files]] better? If you
|
|||
(use-package pdf-tools
|
||||
:mode ("\\.pdf\\'" . pdf-view-mode)
|
||||
:init
|
||||
(setq pdf-info-epdfinfo-program "/usr/local/bin/epdfinfo")
|
||||
(if (ha-running-on-macos?)
|
||||
(setq pdf-info-epdfinfo-program "/opt/homebrew/bin/epdfinfo")
|
||||
(setq pdf-info-epdfinfo-program "/usr/local/bin/epdfinfo"))
|
||||
:general
|
||||
(:states 'normal :keymaps 'pdf-view-mode-map
|
||||
"gp" 'pdf-view-goto-page
|
||||
|
|
|
@ -36,9 +36,13 @@ Let's install and load some of packages from the [[https://github.com/hlissner/d
|
|||
:init
|
||||
(setq doom-modeline-minor-modes nil
|
||||
doom-modeline-buffer-encoding nil
|
||||
doom-modeline-major-mode-color-icon t
|
||||
doom-modeline-buffer-state-icon t
|
||||
doom-modeline-buffer-modification-icon t
|
||||
doom-modeline-modal 'evil
|
||||
doom-modeline-lsp-icon t
|
||||
doom-modeline-percent-position nil)
|
||||
:config
|
||||
(doom-modeline-mode +1))
|
||||
(doom-modeline-mode 1))
|
||||
|
||||
(use-package doom-themes)
|
||||
#+end_src
|
||||
|
@ -346,9 +350,14 @@ Display these two symbols as one:
|
|||
#+begin_src emacs-lisp
|
||||
(add-hook 'text-mode-hook (lambda ()
|
||||
(dolist (pair '(("!?" . "‽")
|
||||
("->" . ?→)
|
||||
("<-" . ?←)
|
||||
("=>" . ?⇒)))
|
||||
("ae" . "æ")
|
||||
("AE" . "Æ")
|
||||
|
||||
;; If we have ligatures, why these?
|
||||
;; ("->" . ?→)
|
||||
;; ("<-" . ?←)
|
||||
;; ("=>" . ?⇒)
|
||||
))
|
||||
(push pair prettify-symbols-alist))))
|
||||
#+end_src
|
||||
|
||||
|
@ -362,10 +371,10 @@ In Emacs 28.1, we have better Unicode 14 support. Which means, we need to instal
|
|||
;; set font for symbols
|
||||
(set-fontset-font t 'symbol
|
||||
(cond
|
||||
((string-equal system-type "darwin")
|
||||
((ha-running-on-macos?)
|
||||
(cond
|
||||
((member "Apple Symbols" (font-family-list)) "Apple Symbols")))
|
||||
((string-equal system-type "gnu/linux")
|
||||
((ha-running-on-linux?)
|
||||
(cond
|
||||
((member "Symbola" (font-family-list)) "Symbola")))))
|
||||
|
||||
|
|
|
@ -145,8 +145,8 @@ Third, you want more /control/, you can use the help:eshell/alias function, but
|
|||
(defun ha-eshell-add-aliases ()
|
||||
"Call `eshell/alias' to define my aliases."
|
||||
;; The 'ls' executable requires the Gnu version on the Mac
|
||||
(let ((ls (if (file-exists-p "/usr/local/bin/gls")
|
||||
"/usr/local/bin/gls"
|
||||
(let ((ls (if (file-exists-p "/opt/homebrew/bin/gls")
|
||||
"/opt/homebrew/bin/gls" ; mac issue only
|
||||
"/bin/ls")))
|
||||
(eshell/alias "ll" (concat ls " -AlohG --color=always"))))
|
||||
#+end_src
|
||||
|
@ -1380,16 +1380,7 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
|||
(bg "#c09644")
|
||||
(dd (thread-last default-directory
|
||||
(replace-regexp-in-string (getenv "HOME") "~")))
|
||||
(gs (thread-last "git status --short --branch --ahead-behind 2>/dev/null"
|
||||
(shell-command-to-list)
|
||||
(first)
|
||||
(replace-regexp-in-string
|
||||
(rx "## "
|
||||
(group (zero-or-more not-newline))
|
||||
(zero-or-more anychar))
|
||||
"\\1")
|
||||
(replace-regexp-in-string
|
||||
(rx "...") " → "))))
|
||||
(gs (or (ha-eshell-banner-git-branch) "")))
|
||||
(ignore-errors
|
||||
(concat
|
||||
;; Line 1
|
||||
|
@ -1400,6 +1391,24 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
|||
;; Line 2
|
||||
(ha-dad-joke)
|
||||
"\n\n"))))
|
||||
|
||||
(defun ha-eshell-banner-git-branch (&optional directory)
|
||||
"Returns the simplified Git branch for DIRECTORY."
|
||||
(let (default-directory)
|
||||
(when directory
|
||||
(setq default-directory directory))
|
||||
(ignore-errors
|
||||
(thread-last "git status --short --branch --ahead-behind 2>/dev/null"
|
||||
(shell-command-to-list)
|
||||
(first)
|
||||
(replace-regexp-in-string
|
||||
(rx "## "
|
||||
(group (zero-or-more not-newline))
|
||||
(zero-or-more anychar))
|
||||
"\\1")
|
||||
(replace-regexp-in-string
|
||||
(rx "...") " → "))))
|
||||
)
|
||||
#+end_src
|
||||
* Shell Windows
|
||||
Now that I often need to pop into remote systems to run a shell or commands, I create helper functions to create those buffer windows. Each buffer begins with =eshell=: allowing me to have more than one eshells, typically, one per project.
|
||||
|
|
|
@ -285,7 +285,7 @@ This function calls the above-mentioned operating-system-specific functions, but
|
|||
(defun ha-search-notes--files (phrase path)
|
||||
"Return an escaped string of all files matching PHRASE.
|
||||
On a Mac, the PATH limits the scope of the search."
|
||||
(let ((command (if (equal system-type 'darwin)
|
||||
(let ((command (if (ha-running-on-macos?)
|
||||
(ha-search-notes--macos phrase path)
|
||||
(ha-search-notes--linux phrase path))))
|
||||
(->> command
|
||||
|
@ -311,7 +311,7 @@ The =ha-search-notes= function prompts for the phrase to search, and then search
|
|||
(defun ha-search-notes (phrase &optional path)
|
||||
"Search files in PATH for PHRASE and display in a grep mode buffer."
|
||||
(interactive "sSearch notes for: ")
|
||||
(let* ((command (if (equal system-type 'darwin) "ggrep" "grep"))
|
||||
(let* ((command (if (ha-running-on-macos?) "ggrep" "grep"))
|
||||
(regexp (string-replace " " "\\|" phrase))
|
||||
(use-paths (or path (list org-directory org-journal-dir)))
|
||||
(files (ha-search-notes--files phrase use-paths))
|
||||
|
|
|
@ -138,7 +138,7 @@ For projects from work, I have found we need to isolate the Ruby environment. On
|
|||
#+begin_src conf
|
||||
# From Apple: /usr/bin/ruby
|
||||
use ruby 2.6.10
|
||||
# Could use 3.2.1 from /usr/local/bin/ruby
|
||||
# Could use 3.2.1 from /opt/homebrew/bin/ruby
|
||||
#+end_src
|
||||
|
||||
A better solution is to create a container to hold the Ruby environment. Begin with a =Dockerfile=:
|
||||
|
|
|
@ -70,7 +70,7 @@ The [[https://github.com/brotzeit/rustic][rustic project]] incorporates [[https:
|
|||
(use-package rustic
|
||||
:init
|
||||
(setq rustic-lsp-client 'eglot
|
||||
rustic-analyzer-command '("/usr/local/bin/rust-analyzer"))
|
||||
rustic-analyzer-command '("/opt/homebrew/bin/rust-analyzer"))
|
||||
;; :bind (:map rustic-mode-map
|
||||
;; ("M-j" . lsp-ui-imenu)
|
||||
;; ("M-?" . lsp-find-references)
|
||||
|
|
|
@ -32,9 +32,11 @@ Farm off commands into /virtual environments/:
|
|||
#+begin_src emacs-lisp
|
||||
(use-package direnv
|
||||
:init
|
||||
(setq direnv--executable "/usr/local/bin/direnv"
|
||||
direnv-always-show-summary t
|
||||
(setq direnv-always-show-summary t
|
||||
direnv-show-paths-in-summary t)
|
||||
(if (ha-running-on-macos?)
|
||||
(setq direnv--executable "/opt/homebrew/bin/direnv")
|
||||
(setq direnv--executable "/usr/local/bin/direnv"))
|
||||
:config
|
||||
(direnv-mode))
|
||||
#+end_src
|
||||
|
|
Loading…
Reference in a new issue