Re: [O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode

2018-10-18 Thread stardiviner


Nicolas Goaziou  writes:

>
> Did you try to set the hook to a different value before (funcall lang-mode)?
>

Yes, like I said in previous messages, I want to make lang-mode-hook empty. It 
tested a few times, with restarting Emacs (loading a refresh Org Mode). It 
failed to fontify source blocks.

Reports error:

Failed to fontify source block.

I can see all source blocks are not fontified. Until I manually load the mode 
with [M-x load-library RET clojure-mode RET]. Then I reopen the Org file, the 
clojure source blocks are fontified.

Also I improved my code:

#+begin_src diff
modified   lisp/org-src.el
@@ -585,7 +585,14 @@ as `org-src-fontify-natively' is non-nil."
(erase-buffer)
;; Add string and a final space to ensure property change.
(insert string " "))
- (unless (eq major-mode lang-mode) (funcall lang-mode))
+ (unless (eq major-mode lang-mode)
+   ;; FIXME: Org mode fontification error in # at 203
+   ;; (let (hook (intern (format "%s-hook" lang-mode)))
+   ;;   (message "%s enabled in source block" lang-mode)
+   ;;   (make-local-variable hook)
+   ;;   (set hook nil)
+   ;;   (message "%s is %s" hook (symbol-value hook)))
+   (funcall lang-mode))
  (org-font-lock-ensure)
  (let ((pos (point-min)) next)
(while (setq next (next-property-change pos))
#+end_src

-- 
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



Re: [O] How to make agenda generation faster

2018-10-18 Thread stardiviner


>> However, before it could be suitable as a possible replacement, it will
>> likely require more optimization.  Some queries, especially more complex
>> ones, are slower than the equivalent searches and agendas in the current
>> Org Agenda code.  This is because of the way the queries run predicates
>> on each heading.  Despite the current Org Agenda code's complexity, it
>> is well optimized and hard to beat.
>
> Are you saying that queries are turned into regexp searches within Org
> files? If so, I don't think they should.
>
> Queries should only operate on the output of the data extraction,
> possibly a list of defstructs. I.e., you first extract all meaningful
> data from the document (during idle time, with cache, or whatever
> optimization would be chosen), store it in an appropriate format, then
> query it.
>

I think the same way. In some language library like Clojure's enlive
handle the HTML string the same way.

--
[ stardiviner ] don't need to convince with trends.
   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3



Re: [O] How to make agenda generation faster

2018-10-18 Thread Nicolas Goaziou
Hello,

Adam Porter  writes:

> Org is welcome to take any of the org-ql or org-ql-agenda code you think
> would be useful.

Thank you.

> However, before it could be suitable as a possible replacement, it will
> likely require more optimization.  Some queries, especially more complex
> ones, are slower than the equivalent searches and agendas in the current
> Org Agenda code.  This is because of the way the queries run predicates
> on each heading.  Despite the current Org Agenda code's complexity, it
> is well optimized and hard to beat.

Are you saying that queries are turned into regexp searches within Org
files? If so, I don't think they should. 

Queries should only operate on the output of the data extraction,
possibly a list of defstructs. I.e., you first extract all meaningful
data from the document (during idle time, with cache, or whatever
optimization would be chosen), store it in an appropriate format, then
query it.

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: ox-odt.el should support text:start-value [9.1.14 (9.1.14-7-g01c419-elpaplus @ …/org-plus-contrib-20181015/)]

2018-10-18 Thread Nicolas Goaziou
Hello,

"Mark A. Hershberger"  writes:

> Working code changes:
>
> diff -ub org-plus-contrib-20181008/ox-odt.el\~ 
> org-plus-contrib-20181008/ox-odt.el
> --- org-plus-contrib-20181008/ox-odt.el~  2018-10-12 19:13:13.095335320 
> -0400
> +++ org-plus-contrib-20181008/ox-odt.el   2018-10-17 22:10:30.194483160 
> -0400
> @@ -1966,10 +1966,13 @@
>  CONTENTS holds the contents of the item.  INFO is a plist holding
>  contextual information."
>(let* ((plain-list (org-export-get-parent item))
> + (count (org-element-property :counter item))
>(type (org-element-property :type plain-list)))
>  (unless (memq type '(ordered unordered descriptive-1 descriptive-2))
>(error "Unknown list type: %S" type))
> -(format "\n\n%s\n%s"
> +(format (concat "\n +(when count (concat (format " text:start-value=\"%s\"" 
> count)))
> +">\n%s\n%s")
>   contents
>   (if (org-element-map item 'table #'identity info 'first-match)
>   ""

Thank you.

Could you provide a patch using git format-patch, with a proper commit
message? Also, if you haven't signed FSF papers, please add TINYCHANGE
at the end of the commit message.

Regards,

-- 
Nicolas Goaziou



Re: [O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode

2018-10-18 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> Here is my try:
>
> #+begin_src diff
> modified   lisp/org-src.el
> @@ -585,7 +585,14 @@ as `org-src-fontify-natively' is non-nil."
>   (erase-buffer)
>   ;; Add string and a final space to ensure property change.
>   (insert string " "))
> -   (unless (eq major-mode lang-mode) (funcall lang-mode))
> +   (unless (eq major-mode lang-mode)
> + (message "%s enabled in source block" lang-mode)
> + ;; (make-local-variable (intern (format "%s-hook" lang-mode)))
> + ;; (set (intern (format "%s-hook" lang-mode)) nil)
> + (message "%s is %s"
> +  (intern (format "%s-hook" lang-mode))
> +  (symbol-value (intern (format "%s-hook" lang-mode
> + (funcall lang-mode))
> (org-font-lock-ensure)
> (let ((pos (point-min)) next)
>   (while (setq next (next-property-change pos))
> #+end_src
>
> But it seems does not work as I expected.

Did you try to set the hook to a different value before (funcall lang-mode)?

Regards,

-- 
Nicolas Goaziou



Re: [O] pcomplete error inside of headline asterisks when typing asterisk

2018-10-18 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> When I create a new headline with =[Alt-Enter]= Under a headline. It looks 
> like this:
>
> #+begin_src org
> ,** headline 1
> ,** headline 2
> #+end_src
>
>
> Then I move point between two asterisks of headline 2. Then I type * again. 
> It report
> following error:
>
> #+begin_example
> Debugger entered--Lisp error: (args-out-of-range "" 1 nil)

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Why is ":CLOCK => hh:mm" allowed as a clock entry?

2018-10-18 Thread Marcin Borkowski
Hi all,

I am studying the `org-clock-sum' function (I need to parse an Org file
and extract clocking data), and I noticed that ":CLOCK => hh:mm" is
allowed as a clock entry.  The Org syntax at
https://orgmode.org/worg/dev/org-syntax.html#Clock,_Diary_Sexp_and_Planning
confirms this.

What is the rationale behind this?  I want not only to sum the clocks
(org-clock-sum does that, of course), but I want more detailed
information (like how many clocks were that in the given period etc.).
The format with only the duration makes this troublesome, and I'd like
to ignore such entries (I have never seen them in my files, of course).
I'm wondering what scenario could lead to their existence?

BTW, the syntax draft says that there can be any TIMESTAMP object before
the DURATION, but `org-clock-sum' assumes that its timestamps are
inactive.  Isn't that a bug?

TIA,

--
Marcin Borkowski
http://mbork.pl