给 Wanderlust 加上 X-Now-Playing

在 Emacs 上运行 AppleScript 见 macOS 10.15 下 Emacs 用不了 AppleScript 了吗?

X-face 见 没有什么用的技巧 - 在邮件中显示你的头像

(defun now-playing ()
  (interactive)
  (let ((s (mac-osa-script "if application \"Music\" is running then
  tell application \"Music\"
    if player state is stopped then
      set display to \"No Track Playing\"
    else
      set track_artist to artist of current track
      set track_name to name of current track
      set display to track_artist & \" - \" & track_name
    end if
  end tell
else
  set display to \"Music.app is not running\"
end if")))
    (setq s (substring-no-properties s 1 (- (length s) 2)))
    (if (called-interactively-p 'interactive)
        (message s)
      s)))
(defun wl-draft-insert-x-now-playing-field ()
  "Insert X-Now-Playing header."
  (interactive)
  (let ((s (now-playing)))
    (if (not (string-match " - " s))
        (message s)
      (goto-char (point-min))
      (search-forward mail-header-separator nil t)
      (beginning-of-line)
      (insert "X-Now-Playing: " s)
      (when (not (= (preceding-char) ?\n))
        (insert ?\n)))))

;; OR

(setf wl-draft-additional-header-alist
      '((X-Now-Playing . wl-draft-x-now-playing-field)))

(defun wl-draft-x-now-playing-field ()
  "Insert X-Now-Playing header."
  (interactive)
  (let ((s (now-playing)))
    (if (not (string-match " - " s))
        nil
      s)))

快进到被 remote code execution :rofl: