议程视图--自定义时间戳格式--“”

议程视图--自定义时间戳格式--“”

是否有任何方法可以修改议程视图中的时间戳格式,类似于我们在常规 Org 模式中所做的操作?我对议程视图的列视图和没有列的常规视图很感兴趣。

(setq org-display-custom-times t)
(setq org-time-stamp-custom-formats (quote ("<%A, %B %d, %Y>" . "<%A, %B %d, %Y -- %I:%M %p>")))

答案1

通过以下内容defalias,可以将函数的最后一行lawlist-org-agenda-format-date-aligned修改为用户希望的任何内容,以便为议程视图中显示的日期设置自定义格式:

(require 'org-agenda)

(defalias 'org-agenda-format-date-aligned 'lawlist-org-agenda-format-date-aligned)

(defun lawlist-org-agenda-format-date-aligned (date)
  "Format a date string for display in the daily/weekly agenda, or timeline.
This function makes sure that dates are aligned for easy reading."
  (require 'cal-iso)
  (let* ((dayname (calendar-day-name date))
     (day (cadr date))
     (day-of-week (calendar-day-of-week date))
     (month (car date))
     (monthname (calendar-month-name month))
     (year (nth 2 date))
     (iso-week (org-days-to-iso-week
            (calendar-absolute-from-gregorian date)))
     (weekyear (cond ((and (= month 1) (>= iso-week 52))
              (1- year))
             ((and (= month 12) (<= iso-week 1))
              (1+ year))
             (t year)))
     (weekstring (if (= day-of-week 1)
             (format " W%02d" iso-week)
               "")))
    (format "%-10s %2d %s %4d%s" dayname day monthname year weekstring)))

相关内容