When you run Bash under shell in Emacs on macOS then update_terminal_cwd is never defined and after every command you get the error message bash: update_terminal_cwd: command not found making the shell unusable.

The simplest solution is to define update_terminal_cwd when it isn’t defined.

Here is the code:

if [ -z "$(type -t update_terminal_cwd)" ] || [ "$(type -t update_terminal_cwd)" != "function" ]; then
update_terminal_cwd() {
true
}
fi


## (Emacs+Org-Mode) Personal Grammar Reminder Affect vs Effect

I always forget a few grammar rules and can’t seem to get them remembered so I wrote an Elisp snippet to help me remember. Langtool catches this but it isn’t worth waiting. It seems silly to me to write a reminder, but, I bet hundreds of us Emacs users face this. The definition is my own, and includes my opinion about how not to use both words!

(defun affect-vs-effect-explanation ()
"Definition and example of the most frequent use of Affect vs. Effect."
(interactive)
(let* ((title "Affect Versus Effect")
(sep (make-string (length title) ?=))
(buf (get-buffer-create (concat "*" title "*"))))
(switch-to-buffer buf)
(insert (concat title "\n"))
(insert (concat sep "\n\n"))
(insert "Affect is a verb. It means \"to have influence upon\". In the present tense
affect is followed by a noun in the form of \"X affects Y\". For example
\"Choosing between tabs or spaces for indentation affects our happiness.\"
In the past tense it is followed by a preposition before the noun.
For example \"Most people are deeply affected by the their choice between
using tabs or spaces for indentation.\"

Effect is a noun. It is an outcome or result of a verb. For example
\"Choosing spaces for indentation had a positive effect on her happiness.\"

There are other definitions for affect and effect and you probably
shouldn't use them.")
(help-mode)


## (Emacs+Org-Mode) How To Probably Configure Everything For UTF-8 In Emacs

There are a lot of snippets laying around about how to configure Emacs for Unicode UTF-8. I’ve copy and pasted all of them at one time of another. Tonight I read the manual about how to configure Language Environments and it is pretty simple:

(let ((lang 'utf-8))
(set-language-environment lang)
(prefer-coding-system lang))


## (Emacs+Org-Mode) Run Two Copies of Emacs To Provide Multithreading

A couple weeks ago I was working on an analysis program in Elisp. I would write the code, run the results out to a file, study the results, make some changes, and go back to the beginning. Sometimes the code would take ten seconds to run. My fault, it just isn’t written for speed. Still I griped about Emacs’s lack of multitheading because I couldn’t do anything for 10 seconds. Then it hit me: Doh! Just start two copies of Emacs, one to run the code in and another to do everything else in.

Sure, that sounds really bad to say it, but I’ll go on: most computers today run with multiple cores and gigabytes of RAM so it has virtually no impact on your operating system to run two instances. Everybody knows this, but my gut says that this is poor OS management and just a bad way to solve problems. But, my gut still thinks about a world where it was excited to double the RAM on it’s 33MHz computer from 4MB to 8MB.

My gut needs to join modern times considering it runs a copy of macOS inside of VMWare all the day while I do everything else, including using two Emacs instances 😄😮.

## (Emacs+Org-Mode) File mode specification error: (error Invalid duration format: “energy”)

Today I got the error:

File mode specification error: (error Invalid duration format: "energy")


This has shown up ten or twenty times over the last year or two.

I couldn’t figure out what caused it.

When I killed all of my buffers and restarted Emacs then the error went away.

## (Emacs+Org-Mode) Hydra For Committing Thing Messages

I want some statistics on my Git commits. Over a time period what did I spend most of it doing? My only questions: what was new, what was refined, and what was fixed. It is a simple question but sometimes I forget the difference between what I consider new versus refined. There are other kids of commits, too.

When I work on GitHub (or the like) I want to handle numbered tasks within my commit message. For example you can close a ticket my writing “Closes #214”. It is commit related. The last thing I use is sort of like a commit.

My Org-Mode workflow is what I feel pretty basic but uses refiling, archiving, and refiling a lot. When I make those changes, it is to me, like a commit.So I put all of those messages in here, too.