emacs

Critique my org elisp

Someday I’ll get around to writing about code quality in elisp, but for now I don’t know it well enough to know idioms and avoid code-smell. Orgmode has a massive code-base and the documentation has a hard-time keeping up, so I asked, How is the following code, aimed at getting the list of header tags and making them into a comma-separated string? org-get-tags didn’t work because I needed to support when the cursor is in the text of an entry, not just on the headline.

Emacs Tip: Registers

The Simple Genius of Emacs Registers It’s been in emacs since the beginning, and is not had in many other editors, yet many people don’t know about it. Registers. The documentation talks about many types, most of which I haven’t tried yet. The three I use the most, however, are: Text in register. Suppose I want a chunk of text but am doing something that will pollute my kill ring, so I can’t just yank (paste) every time.

Orgmode LaTeX collaboration

https://www.reddit.com/r/emacs/comments/hkjyj2/orgmode_latex_collaboration/ I’ve used LaTeX for years as my document production system, so that I need not bother with word processors. I write letters, papers, homework, dissertations, and presentations in it. For the past couple years, though, I’ve been shifting all these to org-mode, which I find much simpler for managing my materials and exporting to LaTeX (as well as anything else). However, now I am back to working on academic papers collaboratively.

Keyboard-driven Editing in 2020

Why Keyboard Driven Editing in this age of the mouse? First of all, the mouse is easy – you don’t need to learn anything to point, drag, and click. And for many problem spaces this is ideal: I browse the web with a mouse (usually because my work as a web application engineer requires it), and I wouldn’t dream of attempting keyboard-driven image editing such as with Gimp or InkScape.

Org view html

I export to HTML fairly often with orgmode. In this case “export and open” resulting in viewing the code is almost never what I want; it would be much more useful like the export pdf option, which doesn’t view to the LaTeX code but right to the PDF. Answer As per https://emacs.stackexchange.com/questions/2387/browser-not-opening-when-exporting-html-from-org-mode A setting change fixed this. M-x customize-variable org-file-apps and for files of type \\.x?html?\\' I specified firefox %s. Now it does what I want.

Improving my elisp by building an API to my YOURLS shortener

Until recently I was well-served by now-derelict url-shortener which worked well. It’s a cool library – very general, supporting a variety of shortening options. But when it broke, it was annoyingly complex to fix. Plus, I needed the excuse to sharpen my elisp skills a bit. The result is below. I learned a lot of good things (big thanks to the Reddit emacs community), including: Using defcustom to create customs groups for use in emacs’ nice customization tooling Utilizing url-build-query-string to build my… well, you know.

Simulating `C-u` args to lambda-wrapped functions

I build hydras for common functions in my use-pattern; sometimes it’s the C-u version that I want in my hydra. Usually this is easily done by passing a '(4) to the function. However, I have one fn that is failing at this: ("<f11>" (lambda () (interactive) (flyspell-correct-wrapper '(4))) "spell correct") ;; eval: Wrong number of arguments: (0 . 0), 1 The reason for this failure is that it turns out emacs has two ways of calling fns with prefix args.

Quickly Creating DB namespaces with shell, emacs, and init.sql

My project design includes creating a file/namespace for each database table, with a suite of CRUD operations applying to each table. The end result is that I have functions like db.my-table/CREATE, READ, UPDATE, and DELETE available for each table. The strategy is as follows: Establish the template clj file that has all your CRUD operations Obtain all table names (e.g. from init.sql) Use a script to create a matching clj file based on template (1) customized to refer to the tables from (2) 1.

Scratch buffer

I have been deep in emacs for over a decade but still never utilized the scratch buffer until I saw how much it was part of the workflow of a friend. I’ve now fixed may ways and just needed a fast way to open it, optionally in a side Window. I wrote up this quick command and bound it to a convenient hydra key and now I have one-stroke scratch buffer opening.

Printing from the Command Line (and emacs)

Helpful Resource: https://www.cyberciti.biz/tips/linux-unix-sets-the-page-size-to-size.html Command Note lp print with good defaults lpc status all See printer settings lprm clear print jobs export PRINTER='Sharp-MX-2700N’ Set the target printer before printing lpoptions See available options I generally print PDFs, using the excellent pdf-tools. This provides C-c C-p which will print with the $PRINTER and settings you’ve configured, but sometimes you need more customization.