Kungsgeten / yankpad

Paste snippets from an org-mode file
MIT License
216 stars 18 forks source link

Error when running yankpad-map #60

Closed sati-bodhi closed 4 years ago

sati-bodhi commented 4 years ago

I get the following error when invoking yankpad-map after switching to castlemacs.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  =(0 nil)
  (if (= 0 n) (throw :exit nil) (while (not (eobp)) (let ((ind (progn (skip-chars-forward " \011") (current-column)))) (cond ((eolp) (delete-region (line-beginning-position) (point))) ((< ind n) (throw :exit nil)) (t (indent-line-to (- ind n)))) (forward-line))) t)
  (let ((n (or n (let ((min-ind (point-max))) (save-excursion (while (re-search-forward "^[ \011]*\\S-" nil t) (let ... ...))) min-ind)))) (if (= 0 n) (throw :exit nil) (while (not (eobp)) (let ((ind (progn (skip-chars-forward " \011") (current-column)))) (cond ((eolp) (delete-region (line-beginning-position) (point))) ((< ind n) (throw :exit nil)) (t (indent-line-to (- ind n)))) (forward-line))) t))
  (catch :exit (goto-char (point-min)) (let ((n (or n (let ((min-ind ...)) (save-excursion (while ... ...)) min-ind)))) (if (= 0 n) (throw :exit nil) (while (not (eobp)) (let ((ind (progn ... ...))) (cond ((eolp) (delete-region ... ...)) ((< ind n) (throw :exit nil)) (t (indent-line-to ...))) (forward-line))) t)))
  org-do-remove-indentation(nil)
  (if (org-do-remove-indentation n) (buffer-string) code)
  (progn (insert code) (if (org-do-remove-indentation n) (buffer-string) code))
  (unwind-protect (progn (insert code) (if (org-do-remove-indentation n) (buffer-string) code)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert code) (if (org-do-remove-indentation n) (buffer-string) code)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert code) (if (org-do-remove-indentation n) (buffer-string) code)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  org-remove-indentation(#("\n" 0 1 (fontified t org-category "yankpad" line-prefix #("*" 0 1 (face org-indent)) wrap-prefix #("*** " 0 1 (face org-indent) 1 4 (face org-indent)))))
  yankpad-snippets-at-point()
  funcall(yankpad-snippets-at-point)
  (setq rtn1 (funcall action))
  (save-excursion (setq rtn1 (funcall action)) (setq rtn (cons rtn1 rtn)))
  (cond ((eq action (quote sparse-tree)) (and org-highlight-sparse-tree-matches (org-get-heading) (match-end 0) (org-highlight-new-match (match-beginning 1) (match-end 1))) (org-show-context (quote tags-tree))) ((eq action (quote agenda)) (setq txt (org-agenda-format-item "" (concat (if (eq org-tags-match-list-sublevels (quote indented)) (make-string (1- level) 46) "") (org-get-heading)) (make-string level 32) category tags-list) priority (org-get-priority txt)) (goto-char lspos) (setq marker (org-agenda-new-marker)) (org-add-props txt props (quote org-marker) marker (quote org-hd-marker) marker (quote org-category) category (quote todo-state) todo (quote ts-date) ts-date (quote priority) priority (quote type) (concat "tagsmatch" ts-date-type)) (setq rtn (cons txt rtn))) ((functionp action) (setq org-map-continue-from nil) (save-excursion (setq rtn1 (funcall action)) (setq rtn (cons rtn1 rtn)))) (t (user-error "Invalid action")))
  (progn (cond ((eq action (quote sparse-tree)) (and org-highlight-sparse-tree-matches (org-get-heading) (match-end 0) (org-highlight-new-match (match-beginning 1) (match-end 1))) (org-show-context (quote tags-tree))) ((eq action (quote agenda)) (setq txt (org-agenda-format-item "" (concat (if (eq org-tags-match-list-sublevels ...) (make-string ... 46) "") (org-get-heading)) (make-string level 32) category tags-list) priority (org-get-priority txt)) (goto-char lspos) (setq marker (org-agenda-new-marker)) (org-add-props txt props (quote org-marker) marker (quote org-hd-marker) marker (quote org-category) category (quote todo-state) todo (quote ts-date) ts-date (quote priority) priority (quote type) (concat "tagsmatch" ts-date-type)) (setq rtn (cons txt rtn))) ((functionp action) (setq org-map-continue-from nil) (save-excursion (setq rtn1 (funcall action)) (setq rtn (cons rtn1 rtn)))) (t (user-error "Invalid action"))) (if org-tags-match-list-sublevels nil (org-end-of-subtree t) (backward-char 1)))
  (if (and (and (or (not todo-only) (member todo org-todo-keywords-1)) (if (functionp matcher) (let ((case-fold-search t) (org-trust-scanner-tags t)) (funcall matcher todo tags-list level)) matcher)) (progn (if (eq action (quote sparse-tree)) nil (org-agenda-skip)) t) (or (not todo-only) (and (member todo org-todo-keywords-1) (or (not org-agenda-tags-todo-honor-ignore-options) (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))) (progn (cond ((eq action (quote sparse-tree)) (and org-highlight-sparse-tree-matches (org-get-heading) (match-end 0) (org-highlight-new-match (match-beginning 1) (match-end 1))) (org-show-context (quote tags-tree))) ((eq action (quote agenda)) (setq txt (org-agenda-format-item "" (concat (if ... ... "") (org-get-heading)) (make-string level 32) category tags-list) priority (org-get-priority txt)) (goto-char lspos) (setq marker (org-agenda-new-marker)) (org-add-props txt props (quote org-marker) marker (quote org-hd-marker) marker (quote org-category) category (quote todo-state) todo (quote ts-date) ts-date (quote priority) priority (quote type) (concat "tagsmatch" ts-date-type)) (setq rtn (cons txt rtn))) ((functionp action) (setq org-map-continue-from nil) (save-excursion (setq rtn1 (funcall action)) (setq rtn (cons rtn1 rtn)))) (t (user-error "Invalid action"))) (if org-tags-match-list-sublevels nil (org-end-of-subtree t) (backward-char 1))))
  (catch :skip (if (and (fboundp (quote org-inlinetask-end-p)) (org-inlinetask-end-p)) (progn (throw :skip t))) (setq todo (and (match-end 1) (match-string-no-properties 1))) (setq tags (and (match-end 4) (org-trim (match-string-no-properties 4)))) (goto-char (setq lspos (match-beginning 0))) (setq level (org-reduced-level (org-outline-level)) category (org-get-category)) (if (eq action (quote agenda)) (progn (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp (point)) ts-date (car ts-date-pair) ts-date-type (cdr ts-date-pair)))) (setq i llast llast level) (while (>= i level) (if (setq entry (assoc i tags-alist)) (progn (setq tags-alist (delete entry tags-alist)))) (setq i (1- i))) (if tags (progn (setq tags (org-split-string tags ":") tags-alist (cons (cons level tags) tags-alist)))) (setq tags-list (if org-use-tag-inheritance (apply (quote append) (mapcar (quote cdr) (reverse tags-alist))) tags) org-scanner-tags tags-list) (if org-use-tag-inheritance (progn (setcdr (car tags-alist) (mapcar (function (lambda (x) (setq x ...) (org-add-prop-inherited x))) (cdr (car tags-alist)))))) (if (and tags org-use-tag-inheritance (or (not (eq t org-use-tag-inheritance)) org-tags-exclude-from-inheritance)) (progn (setcdr (car tags-alist) (org-remove-uninherited-tags (cdr (car tags-alist)))))) (if (and (and (or (not todo-only) (member todo org-todo-keywords-1)) (if (functionp matcher) (let ((case-fold-search t) (org-trust-scanner-tags t)) (funcall matcher todo tags-list level)) matcher)) (progn (if (eq action (quote sparse-tree)) nil (org-agenda-skip)) t) (or (not todo-only) (and (member todo org-todo-keywords-1) (or (not org-agenda-tags-todo-honor-ignore-options) (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)))))) (progn (cond ((eq action (quote sparse-tree)) (and org-highlight-sparse-tree-matches (org-get-heading) (match-end 0) (org-highlight-new-match (match-beginning 1) (match-end 1))) (org-show-context (quote tags-tree))) ((eq action (quote agenda)) (setq txt (org-agenda-format-item "" (concat ... ...) (make-string level 32) category tags-list) priority (org-get-priority txt)) (goto-char lspos) (setq marker (org-agenda-new-marker)) (org-add-props txt props (quote org-marker) marker (quote org-hd-marker) marker (quote org-category) category (quote todo-state) todo (quote ts-date) ts-date (quote priority) priority (quote type) (concat "tagsmatch" ts-date-type)) (setq rtn (cons txt rtn))) ((functionp action) (setq org-map-continue-from nil) (save-excursion (setq rtn1 (funcall action)) (setq rtn (cons rtn1 rtn)))) (t (user-error "Invalid action"))) (if org-tags-match-list-sublevels nil (org-end-of-subtree t) (backward-char 1)))))
  (while (let (case-fold-search) (re-search-forward re nil t)) (setq org-map-continue-from nil) (catch :skip (if (and (fboundp (quote org-inlinetask-end-p)) (org-inlinetask-end-p)) (progn (throw :skip t))) (setq todo (and (match-end 1) (match-string-no-properties 1))) (setq tags (and (match-end 4) (org-trim (match-string-no-properties 4)))) (goto-char (setq lspos (match-beginning 0))) (setq level (org-reduced-level (org-outline-level)) category (org-get-category)) (if (eq action (quote agenda)) (progn (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp (point)) ts-date (car ts-date-pair) ts-date-type (cdr ts-date-pair)))) (setq i llast llast level) (while (>= i level) (if (setq entry (assoc i tags-alist)) (progn (setq tags-alist (delete entry tags-alist)))) (setq i (1- i))) (if tags (progn (setq tags (org-split-string tags ":") tags-alist (cons (cons level tags) tags-alist)))) (setq tags-list (if org-use-tag-inheritance (apply (quote append) (mapcar (quote cdr) (reverse tags-alist))) tags) org-scanner-tags tags-list) (if org-use-tag-inheritance (progn (setcdr (car tags-alist) (mapcar (function (lambda ... ... ...)) (cdr (car tags-alist)))))) (if (and tags org-use-tag-inheritance (or (not (eq t org-use-tag-inheritance)) org-tags-exclude-from-inheritance)) (progn (setcdr (car tags-alist) (org-remove-uninherited-tags (cdr (car tags-alist)))))) (if (and (and (or (not todo-only) (member todo org-todo-keywords-1)) (if (functionp matcher) (let (... ...) (funcall matcher todo tags-list level)) matcher)) (progn (if (eq action (quote sparse-tree)) nil (org-agenda-skip)) t) (or (not todo-only) (and (member todo org-todo-keywords-1) (or (not org-agenda-tags-todo-honor-ignore-options) (not ...))))) (progn (cond ((eq action (quote sparse-tree)) (and org-highlight-sparse-tree-matches (org-get-heading) (match-end 0) (org-highlight-new-match ... ...)) (org-show-context (quote tags-tree))) ((eq action (quote agenda)) (setq txt (org-agenda-format-item "" ... ... category tags-list) priority (org-get-priority txt)) (goto-char lspos) (setq marker (org-agenda-new-marker)) (org-add-props txt props (quote org-marker) marker (quote org-hd-marker) marker (quote org-category) category (quote todo-state) todo (quote ts-date) ts-date (quote priority) priority (quote type) (concat "tagsmatch" ts-date-type)) (setq rtn (cons txt rtn))) ((functionp action) (setq org-map-continue-from nil) (save-excursion (setq rtn1 ...) (setq rtn ...))) (t (user-error "Invalid action"))) (if org-tags-match-list-sublevels nil (org-end-of-subtree t) (backward-char 1))))) (if org-map-continue-from (goto-char org-map-continue-from) (and (= (point) lspos) (end-of-line 1))))
  (save-excursion (goto-char (point-min)) (if (eq action (quote sparse-tree)) (progn (org-overview) (org-remove-occur-highlights))) (while (let (case-fold-search) (re-search-forward re nil t)) (setq org-map-continue-from nil) (catch :skip (if (and (fboundp (quote org-inlinetask-end-p)) (org-inlinetask-end-p)) (progn (throw :skip t))) (setq todo (and (match-end 1) (match-string-no-properties 1))) (setq tags (and (match-end 4) (org-trim (match-string-no-properties 4)))) (goto-char (setq lspos (match-beginning 0))) (setq level (org-reduced-level (org-outline-level)) category (org-get-category)) (if (eq action (quote agenda)) (progn (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp (point)) ts-date (car ts-date-pair) ts-date-type (cdr ts-date-pair)))) (setq i llast llast level) (while (>= i level) (if (setq entry (assoc i tags-alist)) (progn (setq tags-alist (delete entry tags-alist)))) (setq i (1- i))) (if tags (progn (setq tags (org-split-string tags ":") tags-alist (cons (cons level tags) tags-alist)))) (setq tags-list (if org-use-tag-inheritance (apply (quote append) (mapcar (quote cdr) (reverse tags-alist))) tags) org-scanner-tags tags-list) (if org-use-tag-inheritance (progn (setcdr (car tags-alist) (mapcar (function ...) (cdr ...))))) (if (and tags org-use-tag-inheritance (or (not (eq t org-use-tag-inheritance)) org-tags-exclude-from-inheritance)) (progn (setcdr (car tags-alist) (org-remove-uninherited-tags (cdr ...))))) (if (and (and (or (not todo-only) (member todo org-todo-keywords-1)) (if (functionp matcher) (let ... ...) matcher)) (progn (if (eq action ...) nil (org-agenda-skip)) t) (or (not todo-only) (and (member todo org-todo-keywords-1) (or ... ...)))) (progn (cond ((eq action ...) (and org-highlight-sparse-tree-matches ... ... ...) (org-show-context ...)) ((eq action ...) (setq txt ... priority ...) (goto-char lspos) (setq marker ...) (org-add-props txt props ... marker ... marker ... category ... todo ... ts-date ... priority ... ...) (setq rtn ...)) ((functionp action) (setq org-map-continue-from nil) (save-excursion ... ...)) (t (user-error "Invalid action"))) (if org-tags-match-list-sublevels nil (org-end-of-subtree t) (backward-char 1))))) (if org-map-continue-from (goto-char org-map-continue-from) (and (= (point) lspos) (end-of-line 1)))))
  (let* ((re (concat "^" (if start-level (concat "\\*\\{" (number-to-string start-level) "\\} ") org-outline-regexp) " *\\(" (regexp-opt org-todo-keywords-1 (quote words)) "\\)?" " *\\(.*?\\)\\([ \011]:\\(?:" org-tag-re ":\\)+\\)?[ \011]*$")) (props (list (quote face) (quote default) (quote done-face) (quote org-agenda-done) (quote undone-face) (quote default) (quote mouse-face) (quote highlight) (quote org-not-done-regexp) org-not-done-regexp (quote org-todo-regexp) org-todo-regexp (quote org-complex-heading-regexp) org-complex-heading-regexp (quote help-echo) (format "mouse-2 or RET jump to Org file %S" (abbreviate-file-name (or (buffer-file-name ...) (buffer-name ...)))))) (org-map-continue-from nil) lspos tags tags-list (tags-alist (list (cons 0 org-file-tags))) (llast 0) rtn rtn1 level category i txt todo marker entry priority ts-date ts-date-type ts-date-pair) (if (or (member action (quote (agenda sparse-tree))) (functionp action)) nil (setq action (list (quote lambda) nil action))) (save-excursion (goto-char (point-min)) (if (eq action (quote sparse-tree)) (progn (org-overview) (org-remove-occur-highlights))) (while (let (case-fold-search) (re-search-forward re nil t)) (setq org-map-continue-from nil) (catch :skip (if (and (fboundp (quote org-inlinetask-end-p)) (org-inlinetask-end-p)) (progn (throw :skip t))) (setq todo (and (match-end 1) (match-string-no-properties 1))) (setq tags (and (match-end 4) (org-trim (match-string-no-properties 4)))) (goto-char (setq lspos (match-beginning 0))) (setq level (org-reduced-level (org-outline-level)) category (org-get-category)) (if (eq action (quote agenda)) (progn (setq ts-date-pair (org-agenda-entry-get-agenda-timestamp ...) ts-date (car ts-date-pair) ts-date-type (cdr ts-date-pair)))) (setq i llast llast level) (while (>= i level) (if (setq entry (assoc i tags-alist)) (progn (setq tags-alist ...))) (setq i (1- i))) (if tags (progn (setq tags (org-split-string tags ":") tags-alist (cons ... tags-alist)))) (setq tags-list (if org-use-tag-inheritance (apply (quote append) (mapcar ... ...)) tags) org-scanner-tags tags-list) (if org-use-tag-inheritance (progn (setcdr (car tags-alist) (mapcar ... ...)))) (if (and tags org-use-tag-inheritance (or (not ...) org-tags-exclude-from-inheritance)) (progn (setcdr (car tags-alist) (org-remove-uninherited-tags ...)))) (if (and (and (or ... ...) (if ... ... matcher)) (progn (if ... nil ...) t) (or (not todo-only) (and ... ...))) (progn (cond (... ... ...) (... ... ... ... ... ...) (... ... ...) (t ...)) (if org-tags-match-list-sublevels nil (org-end-of-subtree t) (backward-char 1))))) (if org-map-continue-from (goto-char org-map-continue-from) (and (= (point) lspos) (end-of-line 1))))) (if (and (eq action (quote sparse-tree)) (not org-sparse-tree-open-archived-trees)) (progn (org-hide-archived-subtrees (point-min) (point-max)))) (nreverse rtn))
  org-scan-tags(yankpad-snippets-at-point (lambda (todo tags-list level) (progn (setq org-cached-props nil) (or (and (= level 2))))) nil nil)
  (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level))
  (progn (org-agenda-prepare-buffers (and buffer-file-name (list buffer-file-name))) (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level)))
  (if (not scope) (progn (org-agenda-prepare-buffers (and buffer-file-name (list buffer-file-name))) (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level))) (cond ((and scope (listp scope) (symbolp (car scope))) (setq scope (eval scope))) ((eq scope (quote agenda)) (setq scope (org-agenda-files t))) ((eq scope (quote agenda-with-archives)) (setq scope (org-agenda-files t)) (setq scope (org-add-archive-files scope))) ((eq scope (quote file)) (setq scope (and buffer-file-name (list buffer-file-name)))) ((eq scope (quote file-with-archives)) (setq scope (org-add-archive-files (list (buffer-file-name)))))) (org-agenda-prepare-buffers scope) (let ((--dolist-tail-- scope)) (while --dolist-tail-- (let ((file (car --dolist-tail--))) (save-current-buffer (set-buffer (org-find-base-buffer-visiting file)) (save-excursion (save-restriction (widen) (goto-char ...) (setq res ...)))) (setq --dolist-tail-- (cdr --dolist-tail--))))))
  (save-restriction (cond ((eq scope (quote tree)) (org-back-to-heading t) (org-narrow-to-subtree) (setq scope nil)) ((and (or (eq scope (quote region)) (eq scope (quote region-start-level))) (org-region-active-p)) (if start-level (progn (save-excursion (goto-char (region-beginning)) (if (org-at-heading-p) nil (outline-next-heading)) (setq start-level (org-current-level))))) (narrow-to-region (region-beginning) (save-excursion (goto-char (region-end)) (if (and (bolp) (org-at-heading-p)) nil (outline-next-heading)) (point))) (setq scope nil))) (if (not scope) (progn (org-agenda-prepare-buffers (and buffer-file-name (list buffer-file-name))) (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level))) (cond ((and scope (listp scope) (symbolp (car scope))) (setq scope (eval scope))) ((eq scope (quote agenda)) (setq scope (org-agenda-files t))) ((eq scope (quote agenda-with-archives)) (setq scope (org-agenda-files t)) (setq scope (org-add-archive-files scope))) ((eq scope (quote file)) (setq scope (and buffer-file-name (list buffer-file-name)))) ((eq scope (quote file-with-archives)) (setq scope (org-add-archive-files (list (buffer-file-name)))))) (org-agenda-prepare-buffers scope) (let ((--dolist-tail-- scope)) (while --dolist-tail-- (let ((file (car --dolist-tail--))) (save-current-buffer (set-buffer (org-find-base-buffer-visiting file)) (save-excursion (save-restriction ... ... ...))) (setq --dolist-tail-- (cdr --dolist-tail--)))))))
  (save-excursion (save-restriction (cond ((eq scope (quote tree)) (org-back-to-heading t) (org-narrow-to-subtree) (setq scope nil)) ((and (or (eq scope (quote region)) (eq scope (quote region-start-level))) (org-region-active-p)) (if start-level (progn (save-excursion (goto-char ...) (if ... nil ...) (setq start-level ...)))) (narrow-to-region (region-beginning) (save-excursion (goto-char (region-end)) (if (and ... ...) nil (outline-next-heading)) (point))) (setq scope nil))) (if (not scope) (progn (org-agenda-prepare-buffers (and buffer-file-name (list buffer-file-name))) (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level))) (cond ((and scope (listp scope) (symbolp (car scope))) (setq scope (eval scope))) ((eq scope (quote agenda)) (setq scope (org-agenda-files t))) ((eq scope (quote agenda-with-archives)) (setq scope (org-agenda-files t)) (setq scope (org-add-archive-files scope))) ((eq scope (quote file)) (setq scope (and buffer-file-name (list buffer-file-name)))) ((eq scope (quote file-with-archives)) (setq scope (org-add-archive-files (list ...))))) (org-agenda-prepare-buffers scope) (let ((--dolist-tail-- scope)) (while --dolist-tail-- (let ((file ...)) (save-current-buffer (set-buffer ...) (save-excursion ...)) (setq --dolist-tail-- (cdr --dolist-tail--))))))))
  (let* ((org-agenda-archives-mode nil) (org-agenda-skip-archived-trees (memq (quote archive) skip)) (org-agenda-skip-comment-trees (memq (quote comment) skip)) (org-agenda-skip-function (car (org-delete-all (quote (comment archive)) skip))) (org-tags-match-list-sublevels t) (start-level (eq scope (quote region-start-level))) matcher res org-todo-keywords-for-agenda org-done-keywords-for-agenda org-todo-keyword-alist-for-agenda org-tag-alist-for-agenda org--matcher-tags-todo-only) (cond ((eq match t) (setq matcher t)) ((eq match nil) (setq matcher t)) (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) (save-excursion (save-restriction (cond ((eq scope (quote tree)) (org-back-to-heading t) (org-narrow-to-subtree) (setq scope nil)) ((and (or (eq scope ...) (eq scope ...)) (org-region-active-p)) (if start-level (progn (save-excursion ... ... ...))) (narrow-to-region (region-beginning) (save-excursion (goto-char ...) (if ... nil ...) (point))) (setq scope nil))) (if (not scope) (progn (org-agenda-prepare-buffers (and buffer-file-name (list buffer-file-name))) (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level))) (cond ((and scope (listp scope) (symbolp ...)) (setq scope (eval scope))) ((eq scope (quote agenda)) (setq scope (org-agenda-files t))) ((eq scope (quote agenda-with-archives)) (setq scope (org-agenda-files t)) (setq scope (org-add-archive-files scope))) ((eq scope (quote file)) (setq scope (and buffer-file-name ...))) ((eq scope (quote file-with-archives)) (setq scope (org-add-archive-files ...)))) (org-agenda-prepare-buffers scope) (let ((--dolist-tail-- scope)) (while --dolist-tail-- (let (...) (save-current-buffer ... ...) (setq --dolist-tail-- ...))))))) res)
  (if (and (or (eq scope (quote region)) (eq scope (quote region-start-level))) (not (org-region-active-p))) nil (let* ((org-agenda-archives-mode nil) (org-agenda-skip-archived-trees (memq (quote archive) skip)) (org-agenda-skip-comment-trees (memq (quote comment) skip)) (org-agenda-skip-function (car (org-delete-all (quote (comment archive)) skip))) (org-tags-match-list-sublevels t) (start-level (eq scope (quote region-start-level))) matcher res org-todo-keywords-for-agenda org-done-keywords-for-agenda org-todo-keyword-alist-for-agenda org-tag-alist-for-agenda org--matcher-tags-todo-only) (cond ((eq match t) (setq matcher t)) ((eq match nil) (setq matcher t)) (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) (save-excursion (save-restriction (cond ((eq scope (quote tree)) (org-back-to-heading t) (org-narrow-to-subtree) (setq scope nil)) ((and (or ... ...) (org-region-active-p)) (if start-level (progn ...)) (narrow-to-region (region-beginning) (save-excursion ... ... ...)) (setq scope nil))) (if (not scope) (progn (org-agenda-prepare-buffers (and buffer-file-name ...)) (setq res (org-scan-tags func matcher org--matcher-tags-todo-only start-level))) (cond ((and scope ... ...) (setq scope ...)) ((eq scope ...) (setq scope ...)) ((eq scope ...) (setq scope ...) (setq scope ...)) ((eq scope ...) (setq scope ...)) ((eq scope ...) (setq scope ...))) (org-agenda-prepare-buffers scope) (let ((--dolist-tail-- scope)) (while --dolist-tail-- (let ... ... ...)))))) res))
  org-map-entries(yankpad-snippets-at-point "+LEVEL=2" tree)
  yankpad--snippets("org-mode")
  yankpad-set-active-snippets()
  yankpad-active-snippets()
  yankpad-map()
  funcall-interactively(yankpad-map)
  call-interactively(yankpad-map nil nil)
  command-execute(yankpad-map)

Can you tell what is wrong?


Installation code:

(use-package yankpad
  :ensure t
  :defer 10
  :init
  (setq yankpad-file "~/Dropbox/code/yankpad.org")
  :bind
  ("C-`" . yankpad-map)
  ("S-SPC" . yankpad-expand)
;; If you want to complete snippets using company-mode
;;  (add-to-list 'company-backends #'company-yankpad)
  :hook
(org-mode-hook . yas-minor-mode-on))
sati-bodhi commented 4 years ago

The same installation code worked under emacs -q.

sati-bodhi commented 4 years ago

Also worked with the castlemacs init.el. Seems like part of my private init settings broke the function.

sati-bodhi commented 4 years ago

I've isolated the code in my private settings that caused the bug.

(defvar n 1)
(make-variable-buffer-local 'n)