emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Bug: Variable comment-start-skip in the function org-agenda-skip


From: Pierre-Henry F.
Subject: Re: [O] Bug: Variable comment-start-skip in the function org-agenda-skip is nil but should be a string. [9.1.13 (9.1.13-elpa @ ~/.emacs.d/elpa/org-20180716/)]
Date: Sat, 21 Jul 2018 14:09:13 -0400

Ok, I found how to correct it:

(defun proposition_org/extract_posts (x)
  "file_name → [proposition_org]"
  (let ((file_name (expand-file-name x)))
    (cond ((file-exists-p file_name)
           (with-temp-buffer
             (insert-file-contents file_name)
             (org-mode)  ;; <--- THIS IS WHAT WAS MISSING
             (proposition_org/list_propositions_in_buffer)))
          (t '()))))
Best,
PHF





‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On July 21, 2018 6:28 PM, Pierre-Henry F. <address@hidden> wrote:

Hello dear list and thank you for looking at this stuff down below as
well as org-mode and many other things.

Best,
PHF


I get:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    looking-at(nil)
    org-agenda-skip()
    org-scan-tags(proposition_org/if_proposition_then_get_content_else_nil t nil nil)
    org-map-entries(proposition_org/if_proposition_then_get_content_else_nil t)
    (seq-filter 'not (org-map-entries 'proposition_org/if_proposition_then_get_content_else_nil t))
    proposition_org/list_propositions_in_buffer()
    (progn (insert-file-contents file_name) (proposition_org/list_propositions_in_buffer))
    (unwind-protect (progn (insert-file-contents file_name) (proposition_org/list_propositions_in_buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
    (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents file_name) (proposition_org/list_propositions_in_buffer)) (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-file-contents file_name) (proposition_org/list_propositions_in_buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
    (cond ((file-exists-p file_name) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents file_name) (proposition_org/list_propositions_in_buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (t 'nil))
    (let ((file_name (expand-file-name x))) (cond ((file-exists-p file_name) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents file_name) (proposition_org/list_propositions_in_buffer)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (t 'nil)))
    proposition_org/extract_posts("~/tmp.org")
    (message (proposition_org/extract_posts "~/tmp.org"))
    eval((message (proposition_org/extract_posts "~/tmp.org")) nil)
    elisp--eval-last-sexp(nil)
    eval-last-sexp(nil)
    funcall-interactively(eval-last-sexp nil)
    call-interactively(eval-last-sexp nil nil)
    command-execute(eval-last-sexp)


By executing this program:

  ;; Import

  (require 'seq)
  (require 'cl-lib)
  (require 'org)


  ;; Define

  (defun proposition_org/extract_posts (x)
    "file_name → [proposition_org]"
    (let ((file_name (expand-file-name x)))
      (cond ((file-exists-p file_name)
             (with-temp-buffer
               (insert-file-contents file_name)
               (proposition_org/list_propositions_in_buffer)))
            (t '()))))

  (defun proposition_org/list_propositions_in_buffer ()
    "current_buffer → [proposition_org]"

    (seq-filter 'not (org-map-entries 'proposition_org/if_proposition_then_get_content_else_nil t)))

  (defun proposition_org/if_proposition_then_get_content_else_nil ()
    "current_heading → nil | proposition_org"
    (cond ((proposition_org/is_publication) (proposition_org/get_content))
          (t nil)))

  (defun proposition_org/get_content ()
    "current_heading → string"
    (org-narrow-to-subtree)
    (let ((content (buffer-string)))
      (widen)
      content))

  (defun proposition_org/is_publication ()
    "current_heading → boolean"
    (eq (proposition_org/is_proposition_properties (org-entry-properties)) 'true))


  (defun proposition_org/is_proposition_properties (properties)
    "properties ≡ [[key,value]]

     properties → 'true | 'false"

    (let ((proposition_properties_pattern
           (list
            (cons
             (lambda (x) (equal "PUBLIC" x))
             (lambda (x) (equal "true" x)))

            (cons
             (lambda (x) (equal "TARGET_ID" x))
             (lambda (x) (stringp x)))

            (cons
             (lambda (x) (equal "PREVIOUS_VERSION" x))
             (lambda (x) (stringp x)))

            (cons
             (lambda (x) (equal "AUTHOR" x))
             (lambda (x) (stringp x)))

            (cons
             (lambda (x) (equal "TYPE_NAME" x))
             (lambda (x) (equal "proposition_org" x)))

            (cons
             (lambda (x) (equal "TYPE_ID" x))
             (lambda (x) (equal "af7658fc-0541-4cbe-8a5c-04fd5cde74ff" x))))))

      (proposition_org/properties_has_pattern properties proposition_properties_pattern)))

  (defun proposition_org/properties_has_pattern (properties patterns &optional result)
    "properties ≡ [[key,value]]
     patterns ≡ [[predicate,predicate]]

     properties patterns → 'true | 'false"
    (proposition_org/to_truth
     (cond ((null result) (proposition_org/properties_has_pattern properties patterns 'true))
           ((eq result 'false) result)
           ((null patterns) result)
           (t (proposition_org/properties_has_pattern
               properties
               (cdr patterns)
               (proposition_org/to_truth
                (cl-some
                 (lambda (prop) (proposition_org/to_boolean (proposition_org/verify prop (car patterns))))
                 properties)))))))

  (defun proposition_org/to_truth (x)
    (cond ((or (eq x 'false) (eq x 'true)) x)
          (x 'true)
          ((not x) 'false)))

  (defun proposition_org/to_boolean (x)
    (cond ((eq x 'true) t)
          ((eq x 'false) nil)
          (t (error "Expecting 'true or 'false but got something else."))))

  (defun proposition_org/verify (property pattern)
    (proposition_org/to_truth
     (and (funcall (car pattern) (car property))
          (funcall (cdr pattern) (cdr property)))))

  ;; Export

  (message (proposition_org/extract_posts "~/tmp.org"))


With ~/tmp.org pointing at this org file:

  * post_1
    :PROPERTIES:
    :PUBLIC: true
    :TARGET_ID: ab595e70-b729-4524-b614-fc4d46b50152
    :PREVIOUS_VERSION:
    :AUTHOR: XXX
    :TYPE_NAME: proposition_org
    :TYPE_ID: af7658fc-0541-4cbe-8a5c-04fd5cde74ff
    :END:
 
 
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent libero orci, auctor sed, faucibus
  vestibulum, gravida vitae, arcu. Nunc posuere. Suspendisse potenti. Praesent in arcu ac nisl
  ultricies ultricies. Fusce eros. Sed pulvinar vehicula ante. Maecenas urna dolor, egestas vel,
  tristique et, porta eu, leo. Curabitur vitae sem eget arcu laoreet vulputate. Cras orci neque,
  faucibus et, rhoncus ac, venenatis ac, magna. Aenean eu lacus. Aliquam luctus facilisis
  augue. Nullam fringilla consectetuer sapien. Aenean neque augue, bibendum a, feugiat id, lobortis
  vel, nunc. Suspendisse in nibh quis erat condimentum pretium. Vestibulum tempor odio et leo. Sed
  sodales vestibulum justo. Cras convallis pellentesque augue. In eu magna. In pede turpis, feugiat
  pulvinar, sodales eget, bibendum consectetuer, magna. Pellentesque vitae augue.
 
 
  * post_2
 
    lol !
  xd
 
 
  * post_3
 
  why


Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2018-05-29
Package: Org mode version 9.1.13 (9.1.13-elpa @ /home/nomos/.emacs.d/elpa/org-20180716/)

current state:
==============
(setq
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-refile-targets '((nil :maxlevel . 2))
org-enforce-todo-dependencies t
org-modules '(org-bbdb org-bibtex org-docview org-gnus org-habit org-id org-info org-irc org-mhe
               org-rmail org-w3m)
org-mode-hook '(org-clock-load org-shortcuts er/add-org-mode-expansions
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
org-clock-persist 'history
org-archive-hook '(org-attach-archive-delete-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-agenda-todo-list-sublevels nil
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-babel-pre-tangle-hook '(save-buffer)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-hide-leading-stars t
org-clock-clocktable-default-properties '(:maxlevel 3 :scope file)
org-log-done t
org-export-backends '(ascii beamer html icalendar latex org md)
org-agenda-span 'month
org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
                      ("asymptote" . asy) ("dot" . graphviz-dot) ("sqlite" . sql)
                      ("calc" . fundamental) ("C" . c) ("js" . js2) ("cpp" . c++) ("C++" . c++)
                      ("screen" . shell-script))
org-occur-hook '(org-first-headline-recenter)
org-agenda-mode-hook '((lambda nil (local-set-key (kbd "<tab>") (quote org-agenda-goto))))
org-log-into-drawer t
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
org-todo-keywords '("S(s!)" "D(d@/!)" "U(u)" "TODO(t)" "|" "DONE(o!)" "C(c@)")
org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate)
org-capture-before-finalize-hook '(user/before-finalize-capture-hooks)
org-babel-tangle-lang-exts '(("latex" . "tex") ("emacs-lisp" . "el") ("elisp" . "el"))
org-confirm-shell-link-function 'yes-or-no-p
org-link-parameters '(("w3m" :store org-w3m-store-link)
                       ("rmail" :follow org-rmail-open :store org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store org-irc-store-link)
                       ("info" :follow org-info-open :export org-info-export :store
                        org-info-store-link)
                       ("id" :follow org-id-open)
                       ("gnus" :follow org-gnus-open :store org-gnus-store-link)
                       ("docview" :follow org-docview-open :export org-docview-export :store
                        org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
                        org-bbdb-complete-link :store org-bbdb-store-link)
                       ("file+sys") ("file+emacs") ("doi" :follow org--open-doi-link)
                       ("elisp" :follow org--open-elisp-link)
                       ("file" :complete org-file-complete-link)
                       ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path))))
                       ("help" :follow org--open-help-link)
                       ("http" :follow (lambda (path) (browse-url (concat "http:" path))))
                       ("https" :follow (lambda (path) (browse-url (concat "https:" path))))
                       ("mailto" :follow (lambda (path) (browse-url (concat "mailto:" path))))
                       ("news" :follow (lambda (path) (browse-url (concat "news:" path))))
                       ("shell" :follow org--open-shell-link))
org-agenda-skip-scheduled-if-done t
org-todo-keyword-faces '(("U" :foreground "red" :weight bold)
                          ("D" :foreground "DarkOrange" :weight bold)
                          ("S" :foreground "SpringGreen" :weight bold)
                          ("DONE" :foreground "DeepSkyBlue" :weight bold)
                          ("C" :foreground "white" :weight bold)
                          ("TODO" :foreground "red" :weight bold))
org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate
org-deadline-warning-days 0
org-link-search-must-match-exact-headline nil
org-list-indent-offset 2
org-agenda-show-future-repeats 'next
)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]