首页 > 解决方案 > 如何在 spacemacs 中创建自己的函数?

问题描述

我已切换到 Spacemacs,但某些功能不再起作用。

我正在尝试运行一个函数来创建从工作量估计创建的时间范围由 lawlist 创建

(defun org-schedule-effort ()
(interactive)
  (save-excursion
    (org-back-to-heading t)
    (let* (
        (element (org-element-at-point))
        (effort (org-element-property :EFFORT element))
        (scheduled (org-element-property :scheduled element))
        (ts-year-start (org-element-property :year-start scheduled))
        (ts-month-start (org-element-property :month-start scheduled))
        (ts-day-start (org-element-property :day-start scheduled))
        (ts-hour-start (org-element-property :hour-start scheduled))
        (ts-minute-start (org-element-property :minute-start scheduled)) )
      (org-schedule nil (concat
        (format "%s" ts-year-start)
        "-"
        (if (< ts-month-start 10)
          (concat "0" (format "%s" ts-month-start))
          (format "%s" ts-month-start))
        "-"
        (if (< ts-day-start 10)
          (concat "0" (format "%s" ts-day-start))
          (format "%s" ts-day-start))
        " "
        (if (< ts-hour-start 10)
          (concat "0" (format "%s" ts-hour-start))
          (format "%s" ts-hour-start))
        ":"
        (if (< ts-minute-start 10)
          (concat "0" (format "%s" ts-minute-start))
          (format "%s" ts-minute-start))
        "+"
        effort)) )))

但是当我运行M-x org-schedule-effort该功能时没有找到

我知道你会像往常一样称呼它,因为它在 Emacs 中工作

我已将所有功能放入 defun dotspacemacs/user-config ()并使用 hello world 脚本进行了测试

(defun dotspacemacs/user-config ()
    (defun say-hello ()
        "hello")
)

如何在 Spacemacs 中运行 defun?

标签: spacemacs

解决方案


推荐阅读