Xah Emacs Blog Archive 2016-10
the difference a language makes
Apple MacBook Touch Bar. The design of the new MacBook touch bar, and what it means to programers.
Emacs: Cycle Replace Space Hyphen Underscore (updated code. Now will work on inside string quote, if cursor is inside a quote or bracket.)
emacs 25.1 feature. If you open a image, now it scales to fit in the window.
the damage by the hacker types of programers about line formatting.
Emacs: Toggle Comment Current Line (on its own page. updated code.)
emacs M-TAB key poll
Elisp: How to Write Keyword Completion Command (minor update)
emacs info code red
make it red. glorious red.
Elisp: Create Abbrev and Templates for Major Mode (tutorial complete.)
next tutorial in writing a major mode is indentation.
mouse hover tooltip function doc
the mouse hover tooltip now has better background color, and the iPad bug is fixed. You can close the bubble by clicking on it.
for example, goto this page, hover over a elisp function name. On tablet or phone, click it. Emacs Lisp Basics
The Glory of a Real Hacker: Ann Arbor Ambassador 60 Terminal
[Ann Arbor Ambassador 60 Terminal By jwz. At https://www.jwz.org/blog/2016/10/export-termaaa-60/ , accessed on 2016-10-21 ]
emacs history must read.
Coding Convention? Burn It.
Linus in “Linux kernel coding style” said:
“First off, I'd suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it's a great symbolic gesture.”
from reddit, on emacs coding convention. https://www.reddit.com/r/emacs/comments/585osx/emacs_lisp_style_guide/d906u1j
That's a good point. But on a separate note, to a lesser degree, programer's practice of coding style, may be questionable.
Google has many coding styles, including python, HTML, and even Common Lisp. Its python style guide does not necessary agree with Guido's.
Many coding style includes name format convention such as camelCase vs pot_hole_case, do we actually have scientific data about these matters? (there's a couple, but not trust worthy.)
the coding styles may serve more of a purpose of bounding a particular community.
The rules given by bbatsov (i assume community driven) isn't followed by one of the most popular package on MELPA. For example, dash.el ends predicate function with a question mark.
also, gnu emacs suggest cutting lines to 70 char per line in doc. This is not a good convention. The 70 char per line came from punch cards. Coding style sometimes stifle innovation.
GNU Emacs also has a convention that parameter names be ALLCAPS in the docstring. This limits the possibility of actually having ALLCAPS as parameter name, since emacs is case sensitive, but more so, it adds manual burden to programer. A better way is to introduce markers, similar to emacs
check this link out, by the guy who created the Mongrel web server that was used by twitter. (also famous for http://programming-motherfucker.com/ )
〔 Programming Languages Have Social Mores Not Idioms 2012-08-19 By Zed A Shaw. At http://learncodethehardway.org/blog/AUG_19_2012.html 〕
Instead of naming convention and other misc conventions, what might be a step forward, and is happening today in many languages, is to make it part of the language, enforced either by syntax or by the lang's compiler. For example, predicate function all ends in ?, mutation functions ends in !, or dollar sign sigils means global system var, Caps var name means global var, @ sigil means instance var, etc, all enforced by the lang.
Some convention seems obviously good. But, we need awareness of the many problems. By keep discussing about coding style as we have done so, we dilute the idea of automated and language enforced.
corrected a bug from yesterday. Emacs: comment-line vs comment-dwim
Emacs: Cycle Replace Space Hyphen Underscore (more change. Now, by default it works on current line. (it was current word before))
Emacs: Rename File from Space to Hyphen/Underscore (updated code. Now first check if there's space before rename. So you don't get error like file already exist.)
Emacs: Insert Date Time (major rewrite. Now choice of several date time formats.)
Emacs: Tabs, Space, Indentation Setup (updated.)
Emacs: Insert Brackets by Pair (updated code. now, brackets will wrap around symbol when in lisp modes)
Emacs: Reformat Lines for Source Code (bug fix. Now, run of space will be compacted to 1. Refresh page.)
Emacs: Clean Empty Lines (fixed a bug that prevents before save hook from working.)
new version. The functions
xah-replace-regexp-pairs-region now have options to let you highlight. That is, the replaced string will be highlighted in buffer.
Emacs: Open Last Closed File. Add that, if you haven't already.
Emacs: Rename File from Space to Hyphen/Underscore (on its own page)
The command posted yesterday also reverted, so they are not dependent. See Emacs: Cycle Replace Space Hyphen Underscore
new feature. When in dired, it automatically rename current or marked files by replacing space to underscore. You can modify it to rename to using hyphen.
emacs: user-error: tags file doesn't exist
“user-error: File /home/y/TAGS does not exist”
3 hours wasted trying to find where is that path set.
Couldn't find it in any elisp file in my init, lib, or “.emacs.d”.
it seems emacs memorized prev value i used long ago.
(setq tags-table-list '())
Patreon me $5. Ask me question on patreon