Xah Emacs Blog

emacs, real auto save, and auto save when you call M-x

by there's a package called real-auto-save, on melpa. It does “real” save periodically.

i was temped to write my own, but my current solution is that in Emacs: Xah Fly Keys , a modal key mode, everytime i switch to command mode, it also does a save.

you could do the same. For example, everytimes you call M-x, it does a save then M-x. Just write a short elisp command wrapper like “save-buffer-then-execute-extended-command”. If you want and don't know how, ask, many or i can show you how.

reddit comment at https://www.reddit.com/r/emacs/comments/5h7k1r/undo_lost_hours_of_work/dazcpjq/

reading emacs manual vs elisp manual?

if you want to read emacs manual and want to be efficient in learning, read the elisp manual instead.

because emacs really is just lisp interpreter with a user interface. ie the GUI or TUI in terminal

this emacs lisp interpreter environment, is beyond repl. You can eval any buffer, or code, anytime, as in a interactive notebook.

emacs has a repl on top of emacs lisp environment, M-x ielm

〔➤see How to Evaluate Emacs Lisp Code

elisp manual is hard to read. You have to go thru hundred pages just to cover elisp basics. GNU Emacs Lisp Reference Manual (info "(elisp) index")

the hundred pages of elisp manual is summarized just by 10 pages here Emacs Lisp Basics

Emacs: Xah Math Input Mode now can be buffer local or global. Emacs: Xah Math Input Mode

Emacs: Xah Emacs Lisp Mode Much update in past months. If you had problem with company mode, now it's fixed.

emacs lisp completion problem

start emacs with -Q, open a new buffer, M-x emacs-lisp-mode, type defu, press C-M-i, do you get “defun” or “defun-”?

vote here:

if you did get the correct “defun” with your init, what did you do to fix this?

just tried Emacs: Xah Fly Keys on emacs 24.5.1 started with -Q. runs smoothly

Emacs 25.1.1 Change: emacs-lisp-mode extracted from lisp-mode to elisp-mode.el

the emacs dumper dispute

another controversy in emacs. https://www.reddit.com/r/emacs/comments/5frpp4/the_emacs_dumper_dispute/

Emacs Redisplay Internals, and JS Mode War

Emacs: Move Cursor to Brackets, Quotes

updated code. Now xah-goto-matching-bracket will jump to matching quote too. And fixed a bug in xah-forward-quote-smart.

gnu emacs disabled a feature for Mac OS X so that it isn't better than linux version of emacs

gnu emacs removed code for color emoji feature in Mac OS X. see

Bye Bye Emojis: Emacs Hates MacOS By Sebastian Wiesner. @ http://www.lunaryorn.com/posts/bye-bye-emojis-emacs-hates-macos.html

On the OS X Cocoa (“Nextstep”) port, multicolor font (such as color emoji) display is disabled. … This will be enabled again once it is also implemented in Emacs on free operating systems.

reddit discussion https://www.reddit.com/r/emacs/comments/5e3xpu/emojis_in_emacs_intentionally_disabled_for_osx/

see what the current leader jwiegley has to say, in comment above.

jwiegley wrote:

This decision wasn't something “I approved of”, in the sense you're thinking. I do use a Mac, and I do miss my color emojis.

GNU Emacs is a project of the Free Software Foundation, and when they deem an issue as relating to their political agenda, it trumps the technical purview of the project maintainer. I keep Emacs going from a software point of view; they keep the FSF going as a movement.

If RMS says that such a change relates to freedom, I can either acquiesce or walk away. I didn't think color emojis were important enough to walk away. The gcc/clang dispute was part of the reason the last maintainer walked away.

It's a free project. If a group of people is willing to put in the effort, you could fork Emacs and make it into something better, freed from the FSF's policies. Until that happens, expecting them to change by writing blog posts, or commenting on Reddit, is not going to have any effect whatsoever.

by the way, it has always been like that. Every few years, major things like this happen got into news.

See also: GNU Emacs and XEmacs Schism

Emacs: Move Cursor to Brackets, Quotes. new command xah-forward-quote-smart.

Emacs: 1 Key to Copy/Paste from Register

after a decade of back and forth about using this command vs copy-to-register, i think this is far better.

Emacs: Spell Checking

Emacs: Cycle Replace Space Hyphen Underscore (more code update. Now works inside parenthesis or bracket if is.)

keyboard efficiency tip: never mouse aim to close tab

keyboard efficiency tip: never mouse aim to close tab. too much effort. Middle click tab also takes aim. Set Pause key to close tab. Or, F13.

also, set F11 F12 to switch prev/next tab. Make use of all your Function Keys F1 F2…

see how to here: What's the Use of Function Keys F1 F2…?

in emacs, do the same. close buffer, next/prev user buffer, all single, one, key.

when kill buffer, stop emacs from confirming. also, a key to reopen last closed. see how to here: Emacs: Open Last Closed File

command to switch to Next/Previous User Buffer. Skipping scratch, info, shell out, etc buffers. Emacs: Next/Previous User Buffer

if you have a numpad, best is to set keys / * - to prev buffer, next buffer, close buffer. here's how: Emacs: Bind Number Pad Keys

Emacs Lisp: Some and Every

Emacs: Change Brackets () {} [] in Region (rewrite code. Now better code, also highlight changed places.)

emacs abbrev setup: using emacs commands vs using elisp code

after trying to use emacs abbrev commands to build list of abbrevs for a year, don't like it. Am reverting back to using elisp code for abbrev in my emacs init.

The advantage of just following emacs abbrev commands to create edit save abbrev is that, you have a tally of how many times you used each abbre. Sounds useful, but after 3 months, i find that the info isn't useful at all. I find that just a handful of abbrev i use daily, but i still want the rest abbrevs. The idea that i'll modify my abbrev based on the statistics of usage, didn't work out.

But mostly, the problem with following emacs abbrev command to create edit save abbrev is that, you have less control.

with abbrev as elisp code in my init file, i can control the regex used, the expansion function, the hook after expansion, for each abbrev. And, i can just edit it as easily.

Compare, using emacs abbrev commands: Emacs: Abbrev Mode Tutorial vs using elisp code Emacs Lisp: Create Abbrev and Templates for Major Mode

algorithm problem, matching cups and spoon

elisp problem lines and seats 2016-11-02
algorithm problem, matching cups and spoon 2016-11-02

the difference a language makes

elisp while loop vs dolist
elisp while loop vs dolist

Emacs Lisp: Overlay Highlighting

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: Why I Don't Use paredit#comment-2968350605

Emacs: Toggle Comment Current Line (on its own page. updated code.)

emacs M-TAB key poll

emacs meta tab key poll 2016 10 25 twitter emacs meta tab key poll 2016 10 25 google plus
#emacs lang major mode standard key for completion is M-TAB conflict OS Alt+Tab or Cmb+Tab. What do YOU do?

Emacs Lisp: How to Write Keyword Completion Command (minor update)

emacs info code red

emacs info code red
emacs info code red

make it red. glorious red.

〔➤see Emacs's Customization Tutorial

Emacs Lisp: 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. @ https://www.jwz.org/blog/2016/10/export-termaaa-60/

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 `symbol' convention.

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. @ 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.

see

corrected a bug from yesterday. Emacs: comment-line vs comment-dwim

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.)

Emacs: Replace Greek Letter Names to Unicode (new)

Emacs: xah-replace-pairs.el Multi-Pair Find Replace

new version. The functions xah-replace-pairs-region and 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

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.

Solution: (setq tags-table-list '()) once.

Like it? Buy Xah Emacs Tutorial. Thanks.

or, buy something from Best Keyboard for Emacs

Xah Emacs Blog Archive Index