Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
DWIM
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Emacs=== The concept of DWIM has been adopted in augmented form within the context of the [[GNU Emacs]] [[text editor]] to describe the design philosophy of [[Emacs Lisp]] functions or commands that attempt to intelligently "[[Worse is better#Characteristics|do the right thing]]" depending on context.<ref>{{cite web|url=http://www.emacswiki.org/emacs/DoWhatIMean|title=Do What I Mean}}</ref> The Emacs [[wiki]] gives the example of a file copy command that is able to [[Deductive reasoning|deduce]] the destination path from a split window configuration that contains two [[dired]] buffers, one of which displays the source path; this behaviour also generalises to many applicable dired actions that take two directory paths for arguments. DWIM behaviour, when available, is often mentioned in a command's name; e.g. GNU Emacs has a <code>comment-dwim</code> function that comments out a selected region if uncommented, or uncomments it when already commented out, while using comment characters and indentation appropriate for the programming language environment and current context.<ref>{{cite web|url=https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html|title=Comment Tips|quote=Generally speaking, the M-; (comment-dwim) command automatically starts a comment of the appropriate type; or indents an existing comment to the right place, depending on the number of semicolons.}}</ref><ref>{{cite web|url=https://www.gnu.org/software/emacs/manual/html_node/emacs/Comment-Commands.html|title=Comment Commands|quote=The command to create or align a comment is M-; (comment-dwim). The word “dwim” is an acronym for “Do What I Mean”; it indicates that this command can be used for many different jobs relating to comments, depending on the situation where you use it.}}</ref> This kind of DWIM is often not directly concerned with correcting user error but rather guessing user intent from available context. For example, the Emacs [[Magit]] package evinces this design philosophy pervasively. Among its numerous [[diff]] commands, there is a <code>magit-diff-dwim</code> command, which requires no further input from the user but simply guesses what the user wants to analyse based on the location of the [[cursor (user interface)|cursor]]. The Magit User Manual describes the behaviour of <code>magit-diff-dwim</code> simply: "''Show changes for the thing at point''",<ref>{{cite web|url=https://magit.vc/manual/magit/Diffing.html|title=Magit User Manual: 5.4 Diffing}}</ref> "point" being the Emacs term for the text cursor (not the mouse pointer).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)