Create new keybinding in Spacemacs for timestamp with time

31 views Asked by At

I would like to add a new keybinding in Spacemacs for orgmode to insert timestamp with time

It would be something like:

(spacemacs/set-leader-keys "mdh" 'insert-timestamp-with-time)

m => go to major mode d => dates

h => new key to define the insert function

Given the documentation in "usual emacs" it is done with : C-u C-u C-. => calls org-time-stamp with double prefix.

insert-timestamp-with-time does not exist. I do not know how to map a call to org-time-stamp (which exists) with a double prefix.

1

There are 1 answers

0
user1683620 On

I manage to get what i want with :

  (defun insert-inactive-timestamp-with-hour ()
  "Insert an inactive timestamp."
  (interactive)
  (insert (format-time-string "[%Y-%m-%d %a %H:%M:%S]" nil t))
  )


  (with-eval-after-load 'org
    (spacemacs/set-leader-keys-for-major-mode 'org-mode "dh" 'insert-inactive-timestamp-with-hour))