Emacsに存在するwithプレフィックスのマクロ一覧

with マクロは便利。

with-temp-bufferwith-current-buffer は超基本マクロだし、helmなども with-helm-buffer という同じ文脈のマクロを提供している。

ふと、 with= プレフィックスのマクロがどれだけEmacsに用意されているのか気になったので調べた。

ppp, promise, asyncに依存して、次のコード片を実行すれば調べられる。

31シンボル見つかった。

emacs-version
;;=> "26.3"

(ppp-list
 (promise-wait-value
  (promise-wait 5
    (promise:async-start
     (lambda ()
       (let (res)
         (mapatoms
          (lambda (elm)
            (when (and (fboundp elm)
                       (string-prefix-p "with-" (symbol-name elm)))
              (push elm res))))
         (sort res (lambda (a b) (string< (symbol-name a) (symbol-name b))))))))))
;;=> (with-auto-compression-mode
;;    with-case-table
;;    with-category-table
;;    with-coding-priority
;;    with-connection-local-profiles
;;    with-current-buffer
;;    with-current-buffer-window
;;    with-demoted-errors
;;    with-displayed-buffer-window
;;    with-electric-help
;;    with-eval-after-load
;;    with-file-modes
;;    with-help-window
;;    with-isearch-suspended
;;    with-local-quit
;;    with-mutex
;;    with-no-warnings
;;    with-output-to-string
;;    with-output-to-temp-buffer
;;    with-selected-frame
;;    with-selected-window
;;    with-silent-modifications
;;    with-syntax-table
;;    with-temp-buffer
;;    with-temp-buffer-window
;;    with-temp-file
;;    with-temp-message
;;    with-timeout
;;    with-timeout-suspend
;;    with-timeout-unsuspend
;;    with-wrapper-hook)

先のコード片で面倒なことをやっているのは、いわゆる emacs -q で実行した結果を得たいため。 今起動しているEmacsでの結果が欲しい場合はpromiseを消せば良い。

82シンボル見つかった。

(ppp-list
 (let (res)
   (mapatoms
    (lambda (elm)
      (when (and (fboundp elm)
                 (string-prefix-p "with-" (symbol-name elm)))
        (push elm res))))
   (sort res (lambda (a b) (string< (symbol-name a) (symbol-name b))))))
;;=> (with-auto-compression-mode
;;     with-buffer-modified-unmodified
;;     with-case-table
;;     with-category-table
;;     with-coding-priority
;;     with-connection-local-profiles
;;     with-current-buffer
;;     with-current-buffer-window
;;     with-decoded-time-value
;;     with-demoted-errors
;;     with-displayed-buffer-window
;;     with-editor
;;     with-editor*
;;     with-editor--setup
;;     with-editor-async-shell-command
;;     with-editor-cancel
;;     with-editor-debug
;;     with-editor-emacsclient-path
;;     with-editor-emacsclient-version
;;     with-editor-emulate-terminal
;;     with-editor-export-editor
;;     with-editor-export-git-editor
;;     with-editor-export-hg-editor
;;     with-editor-finish
;;     with-editor-kill-buffer-noop
;;     with-editor-locate-emacsclient
;;     with-editor-locate-emacsclient-1
;;     with-editor-mode
;;     with-editor-output-filter
;;     with-editor-process-filter
;;     with-editor-read-envvar
;;     with-editor-return
;;     with-editor-server-window
;;     with-editor-set-process-filter
;;     with-editor-shell-command
;;     with-editor-shell-command-read-args
;;     with-editor-usage-message
;;     with-electric-help
;;     with-eval-after-load
;;     with-feather-dashboard-buffer
;;     with-file-modes
;;     with-helm-after-update-hook
;;     with-helm-alive-p
;;     with-helm-buffer
;;     with-helm-current-buffer
;;     with-helm-default-directory
;;     with-helm-display-marked-candidates
;;     with-helm-in-frame
;;     with-helm-quittable
;;     with-helm-temp-hook
;;     with-helm-time-after-update
;;     with-helm-window
;;     with-help-window
;;     with-httpd-buffer
;;     with-isearch-suspended
;;     with-ivy-window
;;     with-local-quit
;;     with-lsp-workspace
;;     with-lsp-workspaces
;;     with-mutex
;;     with-no-warnings
;;     with-output-to-string
;;     with-output-to-temp-buffer
;;     with-parsed-tramp-file-name
;;     with-ppp--working-buffer
;;     with-selected-frame
;;     with-selected-window
;;     with-silent-modifications
;;     with-slots
;;     with-syntax-table
;;     with-temp-buffer
;;     with-temp-buffer-window
;;     with-temp-file
;;     with-temp-message
;;     with-timeout
;;     with-timeout-suspend
;;     with-timeout-unsuspend
;;     with-tramp-connection-property
;;     with-tramp-file-property
;;     with-tramp-progress-reporter
;;     with-vc-properties
;;     with-wrapper-hook)