Re: [O] Request on modification of org-element.el

2018-11-22 Thread Eric S Fraga
On Friday, 23 Nov 2018 at 08:51, Qiang Fang wrote:
> Hello everyone,
>
> I am a user of kjambunathan's org-mode-ox-odt. The odt exporter needs some
> changed in the upstream org mode. Can you please kindly review the request?

Out of curiosity, what is the effect of this change specifically?  What
is minimal-set referenced in the code you suggest?  I cannot find any
such variable.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442



Re: [O] Request on modification of org-element.el

2018-11-22 Thread Nicolas Goaziou
Hello,

Qiang Fang  writes:

> I am a user of kjambunathan's org-mode-ox-odt. The odt exporter needs some
> changed in the upstream org mode. Can you please kindly review the
> request?

You need to pull again "wip-cite" branch. It was rebased against master
yesterday. So was "wip-cite-awe".

Regards,

-- 
Nicolas Goaziou



Re: [O] don't always restore previous window configuration?

2018-11-22 Thread Eric S Fraga
On Thursday, 22 Nov 2018 at 14:09, Matt Price wrote:
> SO far this is working for me but I wondered whether other people would
> similarly want to change this behaviour and I should put together a proper
> proposal & patch?

Yes, please.  This is becoming more and more necessary as monitors get
larger.  I am using a very wide (and very nice) 38" monitor at work.  My
window configuration within a single frame can get quite
complex.  Having org (and other tools) change this configuration can be
quite annoying.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1035-gfeb442



[O] Request on modification of org-element.el

2018-11-22 Thread Qiang Fang
Hello everyone,

I am a user of kjambunathan's org-mode-ox-odt. The odt exporter needs some
changed in the upstream org mode. Can you please kindly review the request?
Thank you so much!

diff --cc lisp/org-element.el
index cdb574e17,f7498fbd1..0
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@@ -307,12 -322,11 +322,20 @@@ Don't modify it, set `org-element-affil
(strike-through ,@standard-set)
(subscript ,@standard-set)
(superscript ,@standard-set)
++<<< HEAD
 +  ;; Ignore inline babel call and inline source block as formulas
 +  ;; are possible.  Also ignore line breaks and statistics
 +  ;; cookies.
 +  (table-cell bold code entity export-snippet footnote-reference
italic
 +latex-fragment link macro radio-target strike-through
 +subscript superscript target timestamp underline verbatim)
++===
+   ;; Ignore inline babel call and inline src block as formulas are
+   ;; possible.  Also ignore line breaks and statistics cookies.
+   (table-cell ,@(append '(export-snippet footnote-reference link macro
+radio-target target timestamp)
+   minimal-set))
++>>> origin/wip-cite
(table-row table-cell)
(underline ,@standard-set)
(verse-block ,@standard-set)))


[O] [Patch] Allow skipping the local org cycle SUBTREE state

2018-11-22 Thread Matthew Palermo
Hi Org,

Attached is a patch that adds a customization variable,
org-cycle-local-skip-subtree, which, when set to t (nil by default)
will cause the SUBTREE state to be skipped when using org-cycle
locally. All behaviour remains the same by default.

I find the SUBTREE state such an unpleasant experience when using
org-cycle locally to the extent that I find it better when it is
disabled completely. I hope that others might find it useful and I
hope to get it merged into Org so that I don't have to maintain a fork
of org.el.

The change passes the test suite. No tests were added.

Cheers,
Matthew Palermo


0001-org.el-Allow-skipping-the-local-org-cycle-SUBTREE.patch
Description: Binary data


Re: [O] overlay showing computed value of macro?

2018-11-22 Thread Matt Price
On Thu, Nov 22, 2018 at 4:06 PM Matt Price  wrote:

>
>
> On Thu, Nov 22, 2018 at 1:19 PM Matt Price  wrote:
>
>> It would be nice for me to overlay the macro invocations with the values
>> that they will evaluate to on export. I guess I would have to figure out
>> when to trigger recalculation of the values (maybe not too often, say only
>> when the macro is first created, when it's edited or deleted/deformed, and
>> perhaps on structure editing.
>>
>> I do not understand emacs overlays very well so this feels a little
>> daunting to me.  Does anyone out there have ideas about how to do it
>> effectively?
>>
>>
> This is what I've come up with; it feels somewhat close but not quite
> there yet. I can create, remove, and the overlays, which is great.  What I
> miss is the awesomeness of the way that overlays work with org links. I
> love how the link target and the enclosing [[  ][  ]] are invisible until I
> delete one of the "[" elements.  However, with my code, the whole macro
> expression {{{macroname}}} ius invisible until I delete the whole thing, at
> which point the overlay helpfully disappears.  Is htere a way to get
> something like the link behaviour?
>

Oops! Here is the actual code (a bit long actually!  Largely stolen from
org source code).


#+begin_src emacs-lisp

(defun mwp-show-macros ()
  (interactive)
  (remove-overlays (point-min) (point-max) 'macro-ov-p t)
  (save-excursion
(goto-char (point-min))
;; keeping this properties/keywordsstuff b/c I don't quite understand it
(let* ((keywords nil)
   (properties-regexp (format "\\`EXPORT_%s\\+?\\'"
  (regexp-opt keywords)))
   record)
  (while (re-search-forward "{{{[-A-Za-z0-9_]" nil t)
(unless (save-match-data (org-in-commented-heading-p))
  (let* ((datum (save-match-data (org-element-context)))
 (type (org-element-type datum))
 (macro
  (cond
   ((eq type 'macro) datum)
   ;; In parsed keywords and associated node
   ;; properties, force macro recognition.
   ((or (and (eq type 'keyword)
 (member (org-element-property :key datum) keywords))
(and (eq type 'node-property)
 (string-match-p properties-regexp
 (org-element-property :key datum
(save-excursion
  (goto-char (match-beginning 0))
  (org-element-macro-parser))
(when macro
  (let* ((key (org-element-property :key macro))
 (value (org-macro-expand macro org-macro-templates))
 (begin (org-element-property :begin macro))
 (end (save-excursion
(goto-char (org-element-property :end macro))
(skip-chars-backward " \t")
(point)))
 (signature (list begin
  macro
  (org-element-property :args macro
;; Avoid circular dependencies by checking if the same
;; macro with the same arguments is expanded at the
;; same position twice.
(cond ((member signature record)
   (error "Circular macro expansion: %s" key))
  (value
   (push signature record)
   (let ((ov (make-overlay begin end)))
 (overlay-put ov 'invisible t)
 (overlay-put ov 'evaporate t)
 (overlay-put ov 'macro-ov-p t)
 (overlay-put ov 'before-string value )))
  ;; Special "results" macro: if it is not defined,
  ;; simply leave it as-is.  It will be expanded in
  ;; a second phase.
  ((equal key "results"))
  (t
   ;; (error "Undefined Org macro: %s; aborting"
   ;;(org-element-property :key macro))
   )
  (org-macro--counter-initialize)
  (setq-local mwp-macro-overlays t)
  )


(defun mwp-hide-macros ()
  (interactive)
(remove-overlays (point-min) (point-max) 'macro-ov-p t)
(setq-local mwp-macro-overlays nil)
;; (cl-loop for o in (overlays-in (point-min) (point-max))
;;  if (overlay-get o 'macro-ov-p)
;;  ())
)

(defun mwp-toggle-macros ()
  (interactive)
  (if mwp-macro-overlays
  (mwp-hide-macros)
(mwp-show-macros)) )

(defvar-local mwp-macro-overlays nil)
#+end_src


Re: [O] overlay showing computed value of macro?

2018-11-22 Thread Matt Price
On Thu, Nov 22, 2018 at 1:19 PM Matt Price  wrote:

> It would be nice for me to overlay the macro invocations with the values
> that they will evaluate to on export. I guess I would have to figure out
> when to trigger recalculation of the values (maybe not too often, say only
> when the macro is first created, when it's edited or deleted/deformed, and
> perhaps on structure editing.
>
> I do not understand emacs overlays very well so this feels a little
> daunting to me.  Does anyone out there have ideas about how to do it
> effectively?
>
>
This is what I've come up with; it feels somewhat close but not quite there
yet. I can create, remove, and the overlays, which is great.  What I miss
is the awesomeness of the way that overlays work with org links. I love how
the link target and the enclosing [[  ][  ]] are invisible until I delete
one of the "[" elements.  However, with my code, the whole macro expression
{{{macroname}}} ius invisible until I delete the whole thing, at which
point the overlay helpfully disappears.  Is htere a way to get something
like the link behaviour?


> Thanks as always!
>
>


[O] don't always restore previous window configuration?

2018-11-22 Thread Matt Price
I've recently switched to using the current window for editing src blocks w
~(setq org-src-window-setup 'current=window)~. I like this a lot, and it
lets me swtich rapidly back and forth between the parent buffer and source
code.  Often when I ma working I split some of hte other windows to display
other fn definitions or help buffers. I would strongly perfer for htat
window layout not to hcange when I switch back to the parent buffer.  I was
able to change this for myself by wrapping the final ~when
org-src--saved-temp-window-config~ in the definition of ~org-edit-src-exit~
in an unless statement:
(unless (eq 'current-window org-src-window-setup)
(when org-src--saved-temp-window-config
  (set-window-configuration org-src--saved-temp-window-config)
  (setq org-src--saved-temp-window-config nil)))


SO far this is working for me but I wondered whether other people would
similarly want to change this behaviour and I should put together a proper
proposal & patch?


Re: [O] Bug: org-mode - "Wrong type argument: number-or-marker-p, nil" [9.1.14 (9.1.14-1-g4931fc-elpaplus @ /home/emilio/.emacs.d/elpa/org-plus-contrib-20180910/)]

2018-11-22 Thread Emilio Francesquini
Hi Nicolas,

This is not a bug. The function `org-list-struct' has to be called on an
> item, not anywhere within an item. BTW, it is an internal function. You
> may want to use `org-element-at-point' instead.
>

I see! I'll give it a try!

Thanks!


Re: [O] Change default value of org-refile-use-outline-path?

2018-11-22 Thread Colin Baxter
> Eric Abrahamsen  writes:

> Hello, I wonder if there'd be any interest in changing the default
> value of `org-refile-use-outline-path' to something other than
> nil? I can't imagine the nil default would be anyone's preference
> (at least not anyone with more than a handful of headings in a
> single file). How about 'file as a more user-friendly default?

> Eric

Please don't change default values. Users cam always customise the
variable - I have it set to `file'.



[O] overlay showing computed value of macro?

2018-11-22 Thread Matt Price
I use macros in my course syllabi to automate creation of timestamps It
looksl ike this:

# see bottom of this email for the defn of ~get-ts~
#+MACRO: ts (eval (get-ts+7))


** Week {{{n}}} ({{{ts}}}): Time Scales in Rivers, Geology, and Human
Relationships
* Week {{{n}}} ({{{ts}}}): +READING WEEK: NO CLASS
** Week {{{n}}} ({{{ts}}}): Communities, States, and Water Governance

This makes it much easier for me to re-arrange headings while I'm planning
schedules.  But it's a little hard to tell, for instance, if I have the
right number of class meetings, or if the University holidays are in the
right place, etc.

It would be nice for me to overlay the macro invocations with the values
that they will evaluate to on export. I guess I would have to figure out
when to trigger recalculation of the values (maybe not too often, say only
when the macro is first created, when it's edited or deleted/deformed, and
perhaps on structure editing.

I do not understand emacs overlays very well so this feels a little
daunting to me.  Does anyone out there have ideas about how to do it
effectively?

Thanks as always!


[O] Change default value of org-refile-use-outline-path?

2018-11-22 Thread Eric Abrahamsen
Hello,

I wonder if there'd be any interest in changing the default value of
`org-refile-use-outline-path' to something other than nil? I can't
imagine the nil default would be anyone's preference (at least not
anyone with more than a handful of headings in a single file). How about
'file as a more user-friendly default?

Eric