I've tried it various ways over time, and settled on the approach whereby each (potentially-modified) key in a command key sequence is written in standard Emacs notation and wrapped in <kbd> markup, and anything else the user types (commonly at a prompt) is wrapped in backticks.
This distinguishes the command key sequences from other typed text, which I feel makes for the most easily-comprehensible output.
Any concerns about the difficulty of entering the markup would seem to be virtually moot in a forum where every single person writing an answer uses Emacs, given that modern web browsers have extensions to allow you to edit textareas in your editor of choice. Providing some common support elisp for users seems like a Thing We Can Do1.
I agree that the kbd tags should be styled for readability. FWIW, my user style sheet for SO/SE uses the following:
kbd {
background-color: #e9e9e9 !important;
border: 1px solid #999999 !important;
font-weight: bold !important;
font-family: Courier New, Fixed, monospace !important;
font-size: 9pt !important;
}
which for me, renders like so:
or at the default font size:
The following is an example from SO:
So first, check to see if you have an existing file.
C-hv user-init-file
RET
By default it will show you a file path ending in /.emacs
(even if that file doesn't exist), but on the (unlikely, in your case) offchance that it ends in /.emacs.el
or /.emacs.d/init.el
then it would mean that you have an existing init file at that location.
Load that file with the appropriate one of the following:
- C-xC-f
~/.emacs
RET
- C-xC-f
~/.emacs.el
RET
- C-xC-f
~/.emacs.d/init.el
RET
Or you could load it regardless of where it was with:
M-: (find-file user-init-file)
RET
Then you can simply add that line of code to the file:
(setq visible-bell 1)
Save the file:
C-xC-s
And the next time you start Emacs, it will use that setting.
You can also evaluate the setting immediately by typing C-xC-e with the cursor after the closing parenthesis.
1 For starters, a minor modification of Malabarba's answer to I want to have the <kbd> tags for my blog written in org-mode gives us:
(defun my-insert-kbd (key)
;; Based on https://emacs.stackexchange.com/a/2208/454
"Ask for a key then insert its description using <kbd> markup.
Will work in org-mode or in any mode that accepts plain html."
(interactive "kType key sequence: ")
(let* ((is-org-mode (derived-mode-p 'org-mode))
(output (if is-org-mode
"@@html:<kbd>%s</kbd>@@"
"<kbd>%s</kbd>")))
(if (not (equal key "\r")) ;; empty key
(insert
(format output
(mapconcat 'identity
(split-string (help-key-description key nil))
"</kbd><kbd>")))
(insert (format output ""))
(forward-char (if is-org-mode -8 -6)))))
(global-set-key (kbd "C-c k") 'my-insert-kbd)
...
, and kbd loses: 11 for Jon E + 11 for Gilles + 3 for mine = 25; versus 6 for Phils. The 16 for Malabarba don't count either way, as his answer just lists both pros & cons - it does not clearly opt for one or the other. And the 6 for Asmeurer don't count either - that answer is independent of the choice. But if you read all of the comments everywhere, I'd say it is closer than 25 to 6....
examples (other page) should be considered. My 1st choice would be #2b, then #2a/#1a - not #1b. We should start a new vote, with just those options plus one or more <kbd> options: maybe allow 2 votes per person (1st & 2nd choice). Separate any discussion, arguments, examples, etc. from the candidates and their votes.