cpitclaudel/quick-peek

FYI/RFC: org-quick-peek

Closed this issue · 4 comments

Hi, I'm working on a little package based on the code we talked about earlier: https://github.com/alphapapa/org-quick-peek If you have time, I'd love to get any feedback you might have about it before I finish it up and submit to MELPA. Thanks. :)

Sorry to have taken so long. This looks great! I got an error though when trying it out:

Debugger entered--Lisp error: (void-variable path)
  (and path (string= type "id"))
  (if (and path (string= type "id")) (progn (setq marker (org-id-find path 'marker))))
  (progn (setq link (org-link-unescape (org-match-string-no-properties 1))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) (if (string-match org-link-re-with-space3 link) (progn (setq type (match-string 1 link) path (match-string 2 link)))) (if (and path (string= type "id")) (progn (setq marker (org-id-find path 'marker)))) (save-current-buffer (if marker nil (org-open-at-point) (setq marker (point-marker)))) (quick-peek-show (org-quick-peek--get-entry-text marker :num-lines org-quick-peek-show-lines :keep-drawers org-quick-peek-show-drawers)))
  (if (org-in-regexp org-bracket-link-regexp 1) (progn (setq link (org-link-unescape (org-match-string-no-properties 1))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) (if (string-match org-link-re-with-space3 link) (progn (setq type (match-string 1 link) path (match-string 2 link)))) (if (and path (string= type "id")) (progn (setq marker (org-id-find path 'marker)))) (save-current-buffer (if marker nil (org-open-at-point) (setq marker (point-marker)))) (quick-peek-show (org-quick-peek--get-entry-text marker :num-lines org-quick-peek-show-lines :keep-drawers org-quick-peek-show-drawers))))
  (let ((quick-peek-background-face '((t :background "black"))) (org-show-hierarchy-above nil) (org-show-following-heading nil) (org-show-entry-below nil) (org-show-siblings nil) link type marker) (if (and (looking-at org-complex-heading-regexp)) (progn (goto-char (min (1+ (or (match-end 3) (match-end 2) (match-end 1))) (point-at-eol))))) (if (org-in-regexp org-bracket-link-regexp 1) (progn (setq link (org-link-unescape (org-match-string-no-properties 1))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) (if (string-match org-link-re-with-space3 link) (progn (setq type (match-string 1 link) path (match-string 2 link)))) (if (and path (string= type "id")) (progn (setq marker (org-id-find path 'marker)))) (save-current-buffer (if marker nil (org-open-at-point) (setq marker (point-marker)))) (quick-peek-show (org-quick-peek--get-entry-text marker :num-lines org-quick-peek-show-lines :keep-drawers org-quick-peek-show-drawers)))))
  (save-excursion (let ((quick-peek-background-face '((t :background "black"))) (org-show-hierarchy-above nil) (org-show-following-heading nil) (org-show-entry-below nil) (org-show-siblings nil) link type marker) (if (and (looking-at org-complex-heading-regexp)) (progn (goto-char (min (1+ (or ... ... ...)) (point-at-eol))))) (if (org-in-regexp org-bracket-link-regexp 1) (progn (setq link (org-link-unescape (org-match-string-no-properties 1))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) (if (string-match org-link-re-with-space3 link) (progn (setq type (match-string 1 link) path (match-string 2 link)))) (if (and path (string= type "id")) (progn (setq marker (org-id-find path ...)))) (save-current-buffer (if marker nil (org-open-at-point) (setq marker (point-marker)))) (quick-peek-show (org-quick-peek--get-entry-text marker :num-lines org-quick-peek-show-lines :keep-drawers org-quick-peek-show-drawers))))))
  (if (> (quick-peek-hide (point)) 0) nil (save-excursion (let ((quick-peek-background-face '((t :background "black"))) (org-show-hierarchy-above nil) (org-show-following-heading nil) (org-show-entry-below nil) (org-show-siblings nil) link type marker) (if (and (looking-at org-complex-heading-regexp)) (progn (goto-char (min (1+ ...) (point-at-eol))))) (if (org-in-regexp org-bracket-link-regexp 1) (progn (setq link (org-link-unescape (org-match-string-no-properties 1))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) (if (string-match org-link-re-with-space3 link) (progn (setq type ... path ...))) (if (and path (string= type "id")) (progn (setq marker ...))) (save-current-buffer (if marker nil (org-open-at-point) (setq marker ...))) (quick-peek-show (org-quick-peek--get-entry-text marker :num-lines org-quick-peek-show-lines :keep-drawers org-quick-peek-show-drawers)))))))
  org-quick-peek-link()
  funcall-interactively(org-quick-peek-link)

No problem!

The only links supported at the moment are links to Org nodes. I'm guessing that error came from a different kind of link. I'll add code to handle other kinds of links.

Let me know if you need more help / advice :)

Thanks. I had actually forgotten about this for a while. :)