Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

The following is an example from SOexample from SO:

The following is an example from SO:

The following is an example from SO:

replaced http://emacs.stackexchange.com/ with https://emacs.stackexchange.com/
Source Link

1 For starters, a minor modification of Malabarba's answerMalabarba's answer to I want to have the <kbd> tags for my blog written in org-modeI want to have the <kbd> tags for my blog written in org-mode gives us:

(defun my-insert-kbd (key)
  ;; Based on httphttps://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)

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 http://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)

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)
Added my-insert-kbd function
Source Link
phils
  • 53.1k
  • 11
  • 6

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.


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 http://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)

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

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.


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 http://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)
added 115 characters in body
Source Link
phils
  • 53.1k
  • 11
  • 6
Loading
added 115 characters in body
Source Link
phils
  • 53.1k
  • 11
  • 6
Loading
added 381 characters in body
Source Link
phils
  • 53.1k
  • 11
  • 6
Loading
added 5 characters in body
Source Link
phils
  • 53.1k
  • 11
  • 6
Loading
added 5 characters in body
Source Link
phils
  • 53.1k
  • 11
  • 6
Loading
Source Link
phils
  • 53.1k
  • 11
  • 6
Loading