lorniu / mpvi

Media Tool on Emacs, with lots of features integrated, based on EMMS and MPV.
MIT License
57 stars 4 forks source link

(wrong-type-argument integer-or-marker-p nil) #17

Open Mercurius-Lee opened 1 year ago

Mercurius-Lee commented 1 year ago
        (end (save-excursion (goto-char (plist-get node :end)) (skip-chars-backward " \t") (point))))

在mpv的链接中执行命令时,mpvi-parse-link-at-point 函数报错,执行(node(cadr org-element-context))得到的node 中并没有 :end 参数。源码中的:end 指的是?

lorniu commented 6 months ago

能不能提供下链接我测试下?:end 来自 org-element.el 对 org 的解析,表示这个链接结束的位置。

qingshuizheng commented 1 month ago

能不能提供下链接我测试下?:end 来自 org-element.el 对 org 的解析,表示这个链接结束的位置。

我也遇到了,测试视频:https://www.bilibili.com/video/BV1cW42197mq

错误:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  goto-char(nil)
  (save-excursion (goto-char (plist-get node :end)) (skip-chars-backward " \11") (point))
  (let ((meta (mpvi-parse-link (plist-get node :path))) (end (save-excursion (goto-char (plist-get node :end)) (skip-chars-backward " \11") (point)))) (cons ':path (cons (car meta) (cons ':vbeg (cons (car (cdr meta)) (cons ':vend (cons (car ...) (cons ... ...))))))))
  (progn (let ((meta (mpvi-parse-link (plist-get node :path))) (end (save-excursion (goto-char (plist-get node :end)) (skip-chars-backward " \11") (point)))) (cons ':path (cons (car meta) (cons ':vbeg (cons (car (cdr meta)) (cons ':vend (cons ... ...))))))))
  (if (equal "mpv" (plist-get node :type)) (progn (let ((meta (mpvi-parse-link (plist-get node :path))) (end (save-excursion (goto-char (plist-get node :end)) (skip-chars-backward " \11") (point)))) (cons ':path (cons (car meta) (cons ':vbeg (cons (car ...) (cons ... ...))))))))
  (let ((node (car (cdr (org-element-context))))) (if (equal "mpv" (plist-get node :type)) (progn (let ((meta (mpvi-parse-link (plist-get node :path))) (end (save-excursion (goto-char ...) (skip-chars-backward " \11") (point)))) (cons ':path (cons (car meta) (cons ':vbeg (cons ... ...))))))))
  mpvi-parse-link-at-point()
  (let ((node (mpvi-parse-link-at-point))) (if (and node (not (equal (plist-get node :path) (mpvi-origin-path)))) (progn (user-error "Current link is not the actived one, do nothing"))) (if node (progn (let ((ret (mpvi-seek (or ... ...) (format "Set end position (%d-%d): " ... ...)))) (delete-region (plist-get node :begin) (plist-get node :end)) (let ((link (funcall mpvi-build-link-function ... ... ...))) (save-excursion (insert link)))))))
  (progn (mpvi-check-live) (let ((node (mpvi-parse-link-at-point))) (if (and node (not (equal (plist-get node :path) (mpvi-origin-path)))) (progn (user-error "Current link is not the actived one, do nothing"))) (if node (progn (let ((ret (mpvi-seek ... ...))) (delete-region (plist-get node :begin) (plist-get node :end)) (let ((link ...)) (save-excursion (insert link))))))))
  mpvi-current-link-update-end-pos()
  funcall-interactively(mpvi-current-link-update-end-pos)
  call-interactively(mpvi-current-link-update-end-pos nil nil)
  command-execute(mpvi-current-link-update-end-pos)

对以下mpvi中的链接执行:(cadr (org-element-context)),内容为:

[[mpv:https://www.bilibili.com/video/BV1cW42197mq#51.334][▶ 00:51]] 测试

得到

(:standard-properties [359 nil 417 424 427 1 nil nil nil nil nil nil ...] :type "mpv" :type-explicit-p t :path "https://www.bilibili.com/video/BV1cW42197mq#51.334" :format bracket :raw-link "mpv:https://www.bilibili.com/video/BV1cW42197mq#51.334" ...)