points by pdkl95 8 years ago

> it's trying to be "smart"

DWIM ("Do What I Mean") is another example of how somme people fundamentally se computers as "magic". Trying to guess your intention from a few typed words was a terrible way to handle typos and spelling errors when Warren Teitelman tried it at Xerox PARC[1] over 50 years ago, and it's still a terrible idea for the same reasons.

From[2]:

> In one notorious incident, Warren added a DWIM feature to the command interpreter used at Xerox PARC. One day another hacker there typed

    delete *$

> to free up some disk space. (The editor there named backup files by appending $ to the original file name, so he was trying to delete any backup files left over from old editing sessions.) It happened that there weren't any editor backup files, so DWIM helpfully reported

    *$ not found, assuming you meant 'delete *'

> [...] The disgruntled victim later said he had been sorely tempted to go to Warren's office, tie Warren down in his chair in front of his workstation, and then type 'delete *$' twice.

[1] https://en.wikipedia.org/wiki/DWIM

[2] http://www.catb.org/jargon/html/D/DWIM.html

DonHopkins 8 years ago

I prefer "electric" to "smart".

https://www.emacswiki.org/emacs/Electricity

Electricity

The use of “electric” in Emacs is based upon alternative uses of the English word that have evolved over time, at least in the U.S. These are derived from personal experiences with using electricity. For example, a U.S. English dictionary lists both “electrifying” and “thrilling” as definitions for “electric”. Typical usage might be: “The lion act at the circus was electric. I sat on the edge of my seat the entire time!” So, when someone describes a mode or a function in Emacs as “electric”, they are claiming you will be thrilled or electrified by some of its features.

Electric modes tend to do some things “automagically” and/or very cleverly for the user. The electric features are typically continuously active while the MajorMode is active, taking control of things, monitoring and reacting to every input the user makes. Often, electric modes and functions require fewer keystrokes from the user to navigate and to enter data. Sometimes the behavior is “cool”, “clever”, “seems like magic”, and/or is “just really convenient”. You may or may not like what an electric mode or an electric function does while it is active but, whatever it does, it shouldn’t be routine. It should deliver some sort of “Gee Wiz!” behavior.

Examples include certain printing characters in CcMode which after being inserted also indent the current line and/or insert a newline, the ElectricBufferList, and ElectricPair.

https://www.gnu.org/software/emacs/manual/html_node/emacs/El...

26.12.2 Electric C Characters

In C mode and related modes, certain printing characters are electric—in addition to inserting themselves, they also reindent the current line, and optionally also insert newlines. The electric characters are {, }, :, #, ;, ,, <, >, /, *, (, and ).

  • lorenzhs 8 years ago

    Yup this is generally handled very well by Emacs modes and quite useful. But the electricity in C++ mode can be super frustrating when using C++17 which it seemingly hasn’t been updated to handle yet. For example, it keeps double-indenting things inside “if constexpr(...)” environments.