While it may not be possible to live in Emacs 24/7, I am trying to do more things in Emacs. Part of that is using more Eshell.
For each story or defect I would get, I would make a directory with notes and I would backup the files. I have blown away local changes a few times, so I usually make sure that no longer happens. (This past week I lost some files when Windows deleted some files after a forced restart.) Once the story or defect has been released to production, I delete the local backups.
I used to use Notepad++, now I use Emacs. I take the steps and/or subrequirements and make them into a TODO list, making it easier to track progress.
For copying the files, I would make a .bat file, with aliases for directories. I would copy the files to a common directory, and append a number between the name and the extension. SomeFile.java would be copied to SomeFile.002.java, etc. I would edit the file by hand, adding files as I changed them, and incrementing the version number each time. I would then run the file in a DOS window.
Since I started keeping notes in Org, I started copying the files in Eshell. I also added some commands to put a message into a text file. I would edit as needed, and then use set-mark-command and copy-region-as-kill to highlight and copy my commands, then yank them in the Eshell buffer. There might be a way to put it all in an Emacs Lisp file, or use looping and a list, but one step at a time. Switching between buffers is more convenient than switching between applications.
The Eshell version also makes a new directory for each iteration, and moves the files there.
Here is an example, with names changed to protect the innocent (names provided by Random Word Generator):
(setenv "VER_NUM" "006")
(setenv "DATE_STRING" (format-time-string "%Y-%m-%d_%H.%M.%S"))
(setenv "COMMIT_MSG" "advance digress cave committee trouser")
(setenv "STORY_NUM" "CULTIVATE-7659")
(setenv "ARCHIVE_DIR" (concat "C:/EKM/stories/" (getenv "STORY_NUM") "/files"))
(setenv "JAVA_SRC_DIR" "D:/genetic/jurisdiction")
(setenv "SURFACE_PKG" "src/org/partner/sausage")
(setenv "NORTH_PKG" (concat (getenv "JAVA_DIR") "/" (getenv "SURFACE_PKG") "/west/habit/mosquito"))
(setenv "WOLF_PKG" (concat (getenv "JAVA_DIR") "/" (getenv "SURFACE_PKG") "/option/drawer/highlight"))
(setq FILE_DIR (concat (getenv "ARCHIVE_DIR") "/files_" (getenv "STORY_NUM") "_" (getenv "VER_NUM")))
(setenv "COMMIT_FILE" (concat (getenv "FILE_DIR") "/message." (getenv "DATE_STRING")))
cd $ARCHIVE_DIR
cp -v C:/EKM/stories/$STORY_NUM/menu.delete.highway.option.escape_workload.sql $ARCHIVE_DIR/menu.delete.highway.option.escape_workload.$VER_NUM.sql
cp -v $JAVA_SRC_DIR/$NORTH_PKG/PeelBuilder.java $ARCHIVE_DIR/PeelBuilder.$VER_NUM.java
cp -v $JAVA_SRC_DIR/$NORTH_PKG/WaterFactory.java $ARCHIVE_DIR/WaterFactory.$VER_NUM.java
cp -v $JAVA_SRC_DIR/$WOLF_PKG/MushroomAdapter.java $ARCHIVE_DIR/MushroomAdapter.$VER_NUM.java
cp -v $JAVA_SRC_DIR/$WOLF_PKG/WheatBridge.java $ARCHIVE_DIR/WheatBridge.$VER_NUM.java
cp -v $JAVA_SRC_DIR/web/WEB-INF/conf/tiles-defs-case.xml $ARCHIVE_DIR/tiles-defs-case.$VER_NUM.xml
cp -v $JAVA_SRC_DIR/$SURFACE_PKG/common/properties/ApplicationResources.properties $ARCHIVE_DIR/ApplicationResources.$VER_NUM.properties
mkdir $FILE_DIR
mv -v $ARCHIVE_DIR/*.$VER_NUM.* $FILE_DIR
(write-region (concat (getenv "DATE_STRING") ": " (getenv "COMMIT_MSG")) nil (getenv "COMMIT_FILE"))
There is a good article on Eshell on Mastering Emacs. The author and a few commenters lament that Eshell is not well documented. At least one commenter wrote that the article should be incorporated into the Emacs documentation.
There actually is an Eshell manual: you can find it at this page. The list of built-in commands is here. If you look on the Emacs documentation page, there is a list of four links. As of 2023-08-12, they are: GNU Emacs manual, An Introduction to Programming in Emacs Lisp, Emacs Lisp Reference Manual and Other Emacs manuals. The Eshell manual is listed on the page at the “Other Emacs manuals” link. [Note 1]
That page has a lot of manuals. It has links to the other three main manuals, as well as the parts of Emacs not covered in the primary manual: Calc, Eshell, IDO, Org (which is the same as the manual on the Org mode site), Tramp, use-package, and many more. I always went to the primary Emacs manual, and I do not think I had ever looked at the page for the other manuals until I did so by chance a few days ago. I wonder why the manual for Hyperbole is not on the list.
One of the comments on the Mastering Emacs article links to the Eshell page on EmacsWiki. That page has a few gems not in the manual, like for loops. I downloaded the manual source, and grepped with grep -in ‘for.*in\s’ eshell.texi, and I did not see what looked like a for loop.
I also used it on my Windows machine for work. On Linux, Emacs uses the system grep tool when I select M-x grep; this does not work on Windows since there is no grep command by default. Using grep on Eshell on Windows seems to work recursively, but not on Linux. When I did a grep in Eshell on Windows, it added each file it scanned to the list of buffers. It did choke on a large PDF file. I have not the same type of files on my work laptop as I have on my own machine, so my tests are just prelimiary; most of my files on Windows are Office files, large PDF files and large XML files that are all one line.
Note 1: It is not clear to me from the text and comments on the Mastering Emacs article if people are unaware of the Eshell manual, or if they do not think it has enough information to be useful. Nevertheless, I recommend reading all the articles on that site and the book.
This post was created in Emacs with Org Mode and Love. You’re welcome.
Image from the Hidda Codex, an 11-century manuscript housed at the Archbishop’s Diocesan and Cathedral Library in Cologne, Germany, allowed under CC BY-NC 4.0.