Variable: denote-region-after-new-note-functions

denote-region-after-new-note-functions is a customizable variable defined in denote.el.

Value

nil

Documentation

Abnormal hook called after denote-region.

Functions in this hook are called with two arguments, representing the beginning and end buffer positions of the region that was inserted in the new note. These are called only if denote-region is invoked while a region is active.

A common use-case is to call org-insert-structure-template after a region is inserted. This case does not actually require the aforementioned arguments, in which case the function can simply declare them as ignored by prefixing the argument names with an underscore. For example, the following will prompt for a structure template as soon as denote-region is done:

    (defun my-denote-region-org-structure-template (_beg _end)
      (when (derived-mode-p 'org-mode)
        (activate-mark)
        (call-interactively 'org-insert-structure-template)))

    (add-hook 'denote-region-after-new-note-functions
              #'my-denote-region-org-structure-template)

This variable was added, or its default value changed, in denote version 2.1.0.

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defcustom denote-region-after-new-note-functions nil
  "Abnormal hook called after `denote-region'.
Functions in this hook are called with two arguments,
representing the beginning and end buffer positions of the region
that was inserted in the new note.  These are called only if
`denote-region' is invoked while a region is active.

A common use-case is to call `org-insert-structure-template'
after a region is inserted.  This case does not actually require
the aforementioned arguments, in which case the function can
simply declare them as ignored by prefixing the argument names
with an underscore.  For example, the following will prompt for a
structure template as soon as `denote-region' is done:

    (defun my-denote-region-org-structure-template (_beg _end)
      (when (derived-mode-p \\='org-mode)
        (activate-mark)
        (call-interactively \\='org-insert-structure-template)))

    (add-hook \\='denote-region-after-new-note-functions
              #\\='my-denote-region-org-structure-template)"
  :group 'denote
  :package-version '(denote . "2.1.0")
  :link '(info-link "(denote) Create a note with the region's contents")
  :type 'hook)