Skip to content

glucas/yank-temp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

yank-temp

This package provides commands to create a new temporary buffer from some existing text (e.g. the clipboard or region).

Revert Behavior

The intial text is treated as the "revert point" for the buffer: you can make changes and then restore the initial text using the standard revert-buffer command.

Init Hook

Use the yank-temp-initialized-hook to take some action when a new temp buffer is initialized.

For example: define a hydra with frequently-usde modes or commands, and have it pop up for a few seconds after a yank-temp buffer is created:

  (defhydra hydra-setup-yank-temp (:color blue :timeout 3 :post (yank-temp-set-revert-point))
    ("l" lisp-interaction-mode "lisp")
    ("j" (progn (js-mode) (json-pretty-print-buffer)) "json")
    ("x" (progn (nxml-mode)) "xml")
    ("t" (progn (turn-on-orgtbl) (org-table-convert-region (point-min) (point-max) nil)) "table"))

  (add-hook 'yank-temp-initialized-hook #'hydra-setup-yank-temp/body)

About

Yank text in to a new temporary buffer.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published