Re: Help: how to extend org-mode markup?
Well, this works! Thank you all! (defun user-custom-keywords () ;; M-x list-faces-display (let ((user-custom-keywords '((":next:" . 'org-habit-clear-face) (":wait:" . 'org-habit-alert-face) (":failed:" . 'org-habit-overdue-face) (":success:" . 'org-habit-ready-face) (":unscheduled:" . 'avy-lead-face-0 (dolist (elt user-custom-keywords) (let ((regex (car elt)) (face (cdr elt))) (font-lock-add-keywords nil `((,regex 0 ,face t)) 'append) Cordialement, Pierre-Henry FRÖHRING +33 6 34 48 17 57 cont...@phfrohring.com Skype: pierre.henry.frohring ‐‐‐ Original Message ‐‐‐ On Friday, September 25, 2020 10:31 AM, Pierre-Henry F. wrote: > Thank you Ihor, > > It does work... too good now :-) > > all the other faces are gone > > Well, OK... > > I will check that an other time. > > Thank you all for your replies ! > > PHF > > ‐‐‐ Original Message ‐‐‐ > On Friday, September 25, 2020 10:13 AM, Ihor Radchenko yanta...@gmail.com > wrote: > > > > As suggested by Ihor, I tried: > > > > > (font-lock-add-keywords 'org-mode > > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend))) > > > > You need to fontify itafter all other org-mode font settings: > > (font-lock-add-keywords 'org-mode > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append)) > > Best, > > Ihor > > "Pierre-Henry F." cont...@phfrohring.com writes: > > > > > Thank you very much for your replies. > > > Here is the use case: > > > |---+| > > > | something | :next: | > > > |---+| > > > I would like :next: to show up using an arbitrary face. > > > As suggested by Ihor, I tried: > > > (font-lock-add-keywords 'org-mode > > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend))) > > > in my init.el > > > It does not work either. > > > @Christian yes, it's the same syntax as tags, I would like to extend it > > > eventually. > > > Thanks, > > > PHF > > > ‐‐‐ Original Message ‐‐‐ > > > On Friday, September 25, 2020 9:26 AM, Ihor Radchenko yanta...@gmail.com > > > wrote: > > > > > > > > (add-to-list 'org-font-lock-extra-keywords > > > > > > > > It is internal variable. You should not use it. > > > > Simply use font-lock-add-keywords instead. > > > > Best, > > > > Ihor > > > > "Pierre-Henry F." cont...@phfrohring.com writes: > > > > > > > > > Hello, > > > > > I would like to extend the org-mode markup. > > > > > For example, I would like to change the face of a keyword, say: > > > > > :next: . > > > > > Whenever :next: is displayed from an org-mode buffer, it should show > > > > > up in using an arbitrary face. > > > > > I tried this: > > > > > (defun org-add-my-extra-markup () > > > > > (add-to-list 'org-font-lock-extra-keywords > > > > > '("[^\\w]\\(:next:\\)[^\\w]" > > > > > (1 font-lock-warning-face t > > > > > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup) > > > > > But it does not work. > > > > > So: how to extend org-mode markup? > > > > > Many thanks, > > > > > PHF
Re: Help: how to extend org-mode markup?
Thank you Ihor, It does work... too good now :-) all the other faces are gone Well, OK... I will check that an other time. Thank you all for your replies ! PHF ‐‐‐ Original Message ‐‐‐ On Friday, September 25, 2020 10:13 AM, Ihor Radchenko wrote: > > As suggested by Ihor, I tried: > > > (font-lock-add-keywords 'org-mode > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend))) > > You need to fontify itafter all other org-mode font settings: > > (font-lock-add-keywords 'org-mode > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend) 'append)) > > Best, > Ihor > > "Pierre-Henry F." cont...@phfrohring.com writes: > > > Thank you very much for your replies. > > Here is the use case: > > |---+| > > | something | :next: | > > |---+| > > I would like :next: to show up using an arbitrary face. > > As suggested by Ihor, I tried: > > (font-lock-add-keywords 'org-mode > > '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend))) > > in my init.el > > It does not work either. > > @Christian yes, it's the same syntax as tags, I would like to extend it > > eventually. > > Thanks, > > PHF > > ‐‐‐ Original Message ‐‐‐ > > On Friday, September 25, 2020 9:26 AM, Ihor Radchenko yanta...@gmail.com > > wrote: > > > > > > (add-to-list 'org-font-lock-extra-keywords > > > > > > It is internal variable. You should not use it. > > > Simply use font-lock-add-keywords instead. > > > Best, > > > Ihor > > > "Pierre-Henry F." cont...@phfrohring.com writes: > > > > > > > Hello, > > > > I would like to extend the org-mode markup. > > > > For example, I would like to change the face of a keyword, say: :next: . > > > > Whenever :next: is displayed from an org-mode buffer, it should show up > > > > in using an arbitrary face. > > > > I tried this: > > > > (defun org-add-my-extra-markup () > > > > (add-to-list 'org-font-lock-extra-keywords > > > > '("[^\\w]\\(:next:\\)[^\\w]" > > > > (1 font-lock-warning-face t > > > > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup) > > > > But it does not work. > > > > So: how to extend org-mode markup? > > > > Many thanks, > > > > PHF
Re: Help: how to extend org-mode markup?
Thank you very much for your replies. Here is the use case: |---+| | something | :next: | |---+| I would like :next: to show up using an arbitrary face. As suggested by Ihor, I tried: (font-lock-add-keywords 'org-mode '(("\\W\\(:next:\\)\\W" 1 font-lock-warning-face prepend))) in my init.el It does not work either. @Christian yes, it's the same syntax as tags, I would like to extend it eventually. Thanks, PHF ‐‐‐ Original Message ‐‐‐ On Friday, September 25, 2020 9:26 AM, Ihor Radchenko wrote: > > (add-to-list 'org-font-lock-extra-keywords > > It is internal variable. You should not use it. > > Simply use font-lock-add-keywords instead. > > Best, > Ihor > > "Pierre-Henry F." cont...@phfrohring.com writes: > > > Hello, > > I would like to extend the org-mode markup. > > For example, I would like to change the face of a keyword, say: :next: . > > Whenever :next: is displayed from an org-mode buffer, it should show up in > > using an arbitrary face. > > I tried this: > > (defun org-add-my-extra-markup () > > (add-to-list 'org-font-lock-extra-keywords > > '("[^\\w]\\(:next:\\)[^\\w]" > > (1 font-lock-warning-face t > > (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup) > > But it does not work. > > So: how to extend org-mode markup? > > Many thanks, > > PHF
Help: how to extend org-mode markup?
Hello, I would like to extend the org-mode markup. For example, I would like to change the face of a keyword, say: :next: . Whenever :next: is displayed from an org-mode buffer, it should show up in using an arbitrary face. I tried this: (defun org-add-my-extra-markup () (add-to-list 'org-font-lock-extra-keywords '("[^\\w]\\(:next:\\)[^\\w]" (1 font-lock-warning-face t (add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup) But it does not work. So: how to extend org-mode markup? Many thanks, PHF
[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/)]
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 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
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/)]
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. 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 >
Re: [O] Bug: Clock table reports wrong data [9.0.9]
Great! It just works! Sent with [ProtonMail](https://protonmail.com) Secure Email. > Original Message > Subject: Re: Bug: Clock table reports wrong data [9.0.9] > Local Time: July 4, 2017 12:20 AM > UTC Time: July 3, 2017 10:20 PM > From: m...@nicolasgoaziou.fr > To: Pierre-Henry F. <pierrehenry.frohr...@protonmail.com> > emacs-orgmode\@gnu.org <emacs-orgmode@gnu.org> > Hello, > "Pierre-Henry F." <pierrehenry.frohr...@protonmail.com> writes: >> Hello! Given: ** test >> >> #+BEGIN: clocktable :maxlevel 3 :scope subtree :block 2017-07-03 >> #+CAPTION: Clock summary at [2017-07-03 Mon 19:30], for Monday, July 03, >> 2017. >> >> | Headline | Time | | >> |--++--| >> | *Total time* | *1:55* | | >> |--++--| >> | \_ test | | 1:55 | >> #+END: >> :LOGBOOK: >> CLOCK: [2017-07-02 Sun 20:40]--[2017-07-02 Sun 23:55] => 3:15 >> :END: >> If I move the cursor to the "#+BEGIN:" line then "C-c", the table >> reports wrong data. Since ":block 2017-07-03" and "CLOCK: [2017-07-02 >> Sun 20:40]--[2017-07-02 Sun 23:55] => 3:15" then the "*Total time*" >> should be: "0" but it is "*1:55*". > Fixed. Thank you. > Regards, > -- > Nicolas Goaziou
[O] Bug: Clock table reports wrong data [9.0.9]
Hello! Given: ** test #+BEGIN: clocktable :maxlevel 3 :scope subtree :block 2017-07-03 #+CAPTION: Clock summary at [2017-07-03 Mon 19:30], for Monday, July 03, 2017. | Headline | Time | | |--++--| | *Total time* | *1:55* | | |--++--| | \_ test | | 1:55 | #+END: :LOGBOOK: CLOCK: [2017-07-02 Sun 20:40]--[2017-07-02 Sun 23:55] => 3:15 :END: If I move the cursor to the "#+BEGIN:" line then "C-c", the table reports wrong data. Since ":block 2017-07-03" and "CLOCK: [2017-07-02 Sun 20:40]--[2017-07-02 Sun 23:55] => 3:15" then the "*Total time*" should be: "0" but it is "*1:55*". Emacs : GNU Emacs 25.2.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2017-04-21 Package: Org mode version 9.0.9 current state: == (setq 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-export-backends '(ascii beamer html icalendar latex org md) org-hide-leading-stars t org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) ("article" "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) ) org-agenda-skip-deadline-prewarning-if-scheduled t org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook) org-occur-hook '(org-first-headline-recenter) org-metaup-hook '(org-babel-load-in-session-maybe) org-html-format-drawer-function '(closure (htmlize-buffer-places org-html-format-table-no-css htmlize-css-name-prefix htmlize-output-type htmlize-output-type htmlize-css-name-prefix t) (_name contents) contents) org-log-done 'time org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function org-confirm-shell-link-function 'yes-or-no-p org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default org-link-search-must-match-exact-headline nil org-agenda-skip-scheduled-if-done t org-latex-format-headline-function 'org-latex-format-headline-default-function org-enable-table-editor t org-todo-keyword-faces '(("TODO" :foreground "red" :weight bold) ("WAIT" :foreground "orange" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("CANCELLED" :foreground "white" :weight bold)) org-capture-templates '(("p" "personal" entry (file+headline user/tasks-file "tasks") "* TODO \n DEADLINE: %t" :prepend t :clock-in t :clock-resume t) ) org-after-todo-state-change-hook '(org-clock-out-if-current) org-latex-format-drawer-function '(closure (t) (_ contents) contents) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-babel-pre-tangle-hook '(save-buffer) org-mode-hook '((closure (org-inlinetask-min-level buffer-face-mode-face org-struct-menu org-last-state texmathp-why remember-data-file iswitchb-temp-buflist align-mode-rules-list t) nil (add-hook (quote change-major-mode-hook) (quote org-show-block-all) (quote append) (quote local)) ) (closure (org-inlinetask-min-level buffer-face-mode-face org-struct-menu org-last-state texmathp-why remember-data-file iswitchb-temp-buflist calc-embedded-open-mode calc-embedded-open-formula calc-embedded-close-formula align-mode-rules-list org-export-registered-backends t) nil (add-hook (quote change-major-mode-hook) (quote org-show-block-all) (quote append) (quote local)) ) (closure (*this* org-babel-confirm-evaluate-answer-no t) nil (add-hook (quote change-major-mode-hook) (quote org-babel-show-result-all) (quote append) (quote local)) ) 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-archive-hook '(org-attach-archive-delete-maybe) org-agenda-repeating-timestamp-show-all nil org-ascii-format-drawer-function '(closure