branch: externals/iso-date commit 4b916ed79b17c8b299c404d13f8388439bcd6841 Author: Lucas Quintana <lm...@protonmail.com> Commit: Lucas Quintana <lm...@protonmail.com>
Move embark related code to its own file --- embark-iso-date.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ iso-date.el | 22 ++++------------------ 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/embark-iso-date.el b/embark-iso-date.el new file mode 100644 index 0000000000..4e198db068 --- /dev/null +++ b/embark-iso-date.el @@ -0,0 +1,46 @@ +;;; embark-iso-date.el --- Integrate ISO dates with embark -*- lexical-binding: t -*- + +;; Copyright (C) 2025 Lucas Quintana + +;; This file is free software: you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by the +;; Free Software Foundation, either version 3 of the License, or (at +;; your option) any later version. +;; +;; This file is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this file. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This file adds the `iso-date' target to `embark'. + +;;; Code: + +(require 'iso-date) + +(eval-after-load 'embark + '(progn + (embark-define-thingatpt-target iso-date) + (defvar-keymap embark-iso-date-map + :parent embark-general-map + "RET" #'iso-date-show-calendar + "a" #'iso-date-show-org-agenda + "c" #'iso-date-show-calendar + "d" #'iso-date-show-diary + "f" #'iso-date-echo-difference + "p" #'iso-date-pretty-print + "x" #'iso-date-send-to-calc + "<up>" #'iso-date-at-point-day-up + "<down>" #'iso-date-at-point-day-down) + (add-to-list 'embark-repeat-actions 'iso-date-at-point-day-up) + (add-to-list 'embark-repeat-actions 'iso-date-at-point-day-down) + (add-to-list 'embark-target-finders 'embark-target-iso-date-at-point) + (add-to-list 'embark-keymap-alist '(iso-date embark-iso-date-map)))) + +(provide 'embark-iso-date) +;;; embark-iso-date.el ends here diff --git a/iso-date.el b/iso-date.el index 8e3066e47e..86c145859c 100644 --- a/iso-date.el +++ b/iso-date.el @@ -35,10 +35,12 @@ ;; ;; - Converting to `calendar.el' internal format ;; -;; - Integrating ISO dates with `thingatpt.el' -;; ;; - User commands for manipulating dates or integrating them with ;; external packages +;; +;; - Integrating ISO dates with `thingatpt.el' +;; +;; - Integrating ISO dates with embark (see `embark-iso-date.el') ;;; Code: @@ -332,21 +334,5 @@ Returned dates are also in that format." (when (thing-at-point-looking-at iso-date-regexp 10) (cons (match-beginning 0) (match-end 0)))) -;;;; embark.el integration - -(eval-after-load 'embark - '(progn - (embark-define-thingatpt-target iso-date) - (defvar-keymap embark-iso-date-map - :parent embark-general-map - "RET" #'iso-date-show-calendar - "a" #'iso-date-show-org-agenda - "c" #'iso-date-show-calendar - "d" #'iso-date-show-diary - "f" #'iso-date-echo-difference - "p" #'iso-date-pretty-print) - (add-to-list 'embark-target-finders 'embark-target-iso-date-at-point) - (add-to-list 'embark-keymap-alist '(iso-date embark-iso-date-map)))) - (provide 'iso-date) ;;; iso-date.el ends here