1

In Emacs, how can I create a command that will cycle through the elements of the relative timestamp entry to increment or decrement its value.

For example:

01:20:12 :: Some text

  1. When anywhere on the line, a keybinding will cycle through hh, mm, ss
  2. A second keybinding to increment or decrement the numbers keeping the padded zeros.
Drew
  • 29,895
  • 7
  • 74
  • 104

2 Answers2

0

You can use library DoReMi to easily create commands that increment/decrement something using the arrow keys (for example).

All you need is doremi.el, but doremi-mac.el can also be helpful to define DoReMi commands and add them to menus.

Drew
  • 29,895
  • 7
  • 74
  • 104
0

I use evil-numbers for this, along with easy-repeat. (evil-numbers is completely independent of evil.) Apologies if you don't use use-package. This doesn't help with your first question.

(use-package evil-numbers
  :config
  (easy-repeat-add 'evil-numbers/inc-at-pt 'evil-numbers/dec-at-pt)

  :bind (("C-c =" . evil-numbers/inc-at-pt)
         ("C-c -" . evil-numbers/dec-at-pt))
  )

(use-package easy-repeat
  :defer 1
  :config
  (defun easy-repeat-add (&rest commands)
    "Add COMMANDS to `easy-repeat-command-list'."
    (dolist (f commands)
      (add-to-list 'easy-repeat-command-list f))
    (easy-repeat-mode +1))

  (easy-repeat-add 'help-go-back 'help-go-forward
                   'next-buffer 'previous-buffer)

  (easy-repeat-mode 1)
  )
jpkotta
  • 9,237
  • 3
  • 29
  • 34