[O] lots of trouble w/ org-mime...

2018-10-21 Thread Matt Price
I'm having a whole bunch of trouble getting org-mime to work, and I
wondered ifo ther people are using it productively?

Two biggest issues so far, both reproduced with emacs -Q on recent emacs
git, org-mode git, and org-mime git:

- org-mime-org-subtree-htmlize fails for me with "org-back-to-heading:
before first heading"
- org-mime-org-buffer-htmlize runs successfully, but only produces the html
mime part; the text/plain message part is empty.

org-mime-htmlize, when run in a mail buffer, still seems to work & produce
a 2-part message with text/plain and text/html working well.

Have folks seen this before & do you have a fix? thank you!


Re: [O] Org source block header argument :var does not support space separated string

2018-10-21 Thread stardiviner


Nicolas Goaziou  writes:

> Anyway, I tried the following block:
>
> #+begin_src emacs-lisp :var encrypted="base64 encrypt text"
> encrypted
> #+end_src
>
> and the output is
>
> #+results:
> : base64 encrypt text
>
> which means there doesn't seem to be a problem with strings within
> quotes.
>
> Regards,

Oops, I misunderstand the :var variable="literal quoted string".
I want to reference the named source's result in variable.

Like:

 encrypt text -- ~<<< [TEXT]~

#+NAME: base64 encrypt text
#+begin_src sh
base64 <<< "stardiviner "
#+end_src

#+RESULTS: base64 encrypt text
: c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==

 decrypt text -- ~-d~

#+begin_src sh :var encrypted=
# base64 -d <<< c3RhcmRpdmluZXIgPG51bWJjaGlsZEBnbWFpbC5jb20+Cg==
# base64 -d <<< $encrypted
echo $encrypted
#+end_src

#+RESULTS[<2018-10-20 16:46:10> 6e5d3875d0928eb95ec1356661f965bdf4882244]:

I can use #+NAME: base64-encrypt-text for first source block, and :var 
encrypted=base64-encrypt-text for second source block. So it can work. But is 
it possible to allow space in source block name and make it still can be 
referenced? Like quote it with <> around the name as my upper example?

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



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

2018-10-21 Thread Marcin Borkowski


On 2018-10-20, at 10:26, Nicolas Goaziou  wrote:

> Hello,
>
> Marcin Borkowski  writes:
>
>> 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.
>
>   CLOCK:
>
> and
>
>   CLOCK: => hh:mm
>
> are simply empty clocks.
>
>> What is the rationale behind this?
>
> Treating them as regular text would complicate parsing unnecessarily,
> e.g., to determine when to stop a paragraph. 

OK, I don't fully get it, but I believe you. :-)

> There are other cases that can lead to odd clocks:
>
>   CLOCK: INACTIVE-TIMESTAMP => HH:MM
>
> where INACTIVE-TIMESTAMP is not a timestamp range.
>
>> 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?
>
> Hand-writing a clock information?
>
> In any case, you can simply ignore them whenever you find them – which
> shouldn't happen, right?

Yes, that's what I thought.

> We can also add a checker in Org Lint for those problematic cases.

Might be a good idea, though definitely very low priority.

>> 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?
>
> This is an oversight. Clock timestamps must be inactive. I will fix it.

Thanks.

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: [O] electric-pair, autopair, smartparens, etc in org-mode

2018-10-21 Thread Matt Price
wow, I learned a whole lot from your answer Nicholas, but still not quite
enough to make this work for me.  After some puzzling over the syntax for
character values, I believe that what I want should be something like this:

(add-function :before-until electric-pair-inhibit-predicate
  (lambda (c)
(and (eq ?\[ c)
 (eq major-mode 'org-mode)
 (memq (char-before (1- (point))) '(?\[ ?\])

The manual says to use advice-add instead of add-function for these cases,
so this could be written like this instead:

(defun mwp-org-mode-electric-inhibit (c)
  (and
   (eq ?\[ c)
   (eq major-mode 'org-mode)
   (memq (char-before (1- (point))) '(?\[ ?\]) )))

(advice-add electric-pair-inhibit-predicate :before-until
#'mwp-org-mode-electric-inhibit)

it seems to sort of work.  That is, the code is effective, but it doesn't
do what I want, so I had to think about the desired behaviour, which is
maybe too complex for this modification:

when I start a link [
go ahead and add pair to
[]
when I add a second [, don't complete
[[]
this is what my code does!

but what I really want is, when I finish adding a link reference, somehow
allow me to stay inside the link to add the link text:
[[https://google.com]] --> [[https://google.com][]]
with point between the final [ and ].
This seems like it needs a more complex intervention.

For now I've just turned off pairing of brackets entirely:

(defun mwp-org-mode-electric-inhibit (c)
  (and
   (eq ?\[ c)
   (eq major-mode 'org-mode))

This works fine, though I'd still like the other :-/

Thanks Nicholas!
On Sun, Oct 21, 2018 at 3:28 AM Nicolas Goaziou 
wrote:

> Hello,
>
> Matt Price  writes:
>
> > - electric-pair and autopair complete [[ immediately, and don't seem to
> > allow me to skip past the closing brackets, so if I try to type [[
> > https://link.to.somewhere][link text]] I end up with
> > [[link.to.somewhere]][link-text] .
>
> I use C-c C-l to insert links with description. However, electric
> pairing does get in the way when writing sub/superscript. I use the
> following snippet to work around the issue:
>
>(add-function :before-until electric-pair-inhibit-predicate
>  (lambda (c)
>(and (eq ?\{ c)
> (eq major-mode 'org-mode)
> (memq (char-before (1- (point))) '(?_ ?^)
>
> I guess you could do something similar to disable pairing when entering
> a bracket link.
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] [PATCH] org-capture: fix capture breaking next headline

2018-10-21 Thread Martin Yrjölä
Hello,

I have noticed my capture workflow breaking org document hierarchies.
Here is an example:

Start with the org document:

* A
* B

An org capture template inserts a headline under A.

* A
** [point here]
* B

When I navigate to the end of the narrowed capture buffer (e.g.
`(end-of-buffer)')  and insert text, it will break the B headline like
this:

* A
**
inserted text[point here]* B

I expected the following behavior

* A
** inserted text[point here]
* B

In the enclosed patch, I added a test for this behavior. I would
prefer that inserting text in narrowed capture buffers would not break
the document hierarchy. The fix is to subtract one from the `end'
originally supplied to `org-capture-narrow'.

--
Martin Yrjölä


0001-org-capture-fix-capture-breaking-next-headline.patch
Description: Binary data


[O] FW: [RFC] Link-type for attachments, more attach options

2018-10-21 Thread Gustav Wikström
Hi,

I’ve attached a patch with some suggested additions to org-attach. Patch 
comments below. Please review.

Kind regards
Gustav
___
Patch comments:
* Add new linktype "attached" for attachments

A new linktype "attached" is added in order to reduce link-duplication
when wanting to link to files in attached folders of nodes. This works
for both ID-based attachments and ATTACH_DIR.  Inline images will
trigger also for attachments, as well as search-decorations in the
links.  The goal is to make the functionality for attached-links
mirror file-links.

* Add further options for ATTACH_DIR

When working with ATTACH_DIR there are now a couple of new options available:
- org-attach-dir-inherit-by-default
- org-attach-dir-create-if-not-exist
- org-attach-dir-relative

Descriptions of them can be found in the commit for each new customization.

* Documentation in org-manual

Org-manual is updated with the new link-type as well as some minor
cleanup in the documentation related to external links and attachments.




0001-org-attach-org-manual-org-New-link-type-more-attach-.patch
Description: 0001-org-attach-org-manual-org-New-link-type-more-attach-.patch


Re: [O] electric-pair, autopair, smartparens, etc in org-mode

2018-10-21 Thread Nicolas Goaziou
Hello,

Matt Price  writes:

> - electric-pair and autopair complete [[ immediately, and don't seem to
> allow me to skip past the closing brackets, so if I try to type [[
> https://link.to.somewhere][link text]] I end up with
> [[link.to.somewhere]][link-text] .

I use C-c C-l to insert links with description. However, electric
pairing does get in the way when writing sub/superscript. I use the
following snippet to work around the issue:

   (add-function :before-until electric-pair-inhibit-predicate
 (lambda (c)
   (and (eq ?\{ c)
(eq major-mode 'org-mode)
(memq (char-before (1- (point))) '(?_ ?^)

I guess you could do something similar to disable pairing when entering
a bracket link.

Regards,

-- 
Nicolas Goaziou



[O] Bug: How can I keep time of the day after shifting multiple dates on the agenda view? [9.1.14 (9.1.14-1-g4931fc-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20180910/)]

2018-10-21 Thread Davi Ramos
I'm using batch agenda commands to change the dates of several dates,
using the format "++8d" from the docs. The problem is that the time of day
vanishes when I do that. I want to update the deadlines, but also keep
their original times of the day.

**Example**:

** TODO Some task
DEADLINE: <2018-10-22 Mon 17:00>

** TODO Some other task
DEADLINE: <2018-10-23 Tue 20:00>

After `++1d`, what I want is:

** TODO Some task
DEADLINE: <2018-10-23 Tue 17:00>

** TODO Some other task
DEADLINE: <2018-10-24 Wed 20:00>

But the actual result is:

** TODO Some task
DEADLINE: <2018-10-23 Tue>

** TODO Some other task
DEADLINE: <2018-10-24 Wed>



Emacs  : GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
2.24.31)
 of 2018-08-16
Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpaplus @
~/.emacs.d/elpa/org-plus-contrib-20180910/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-fontify-whole-heading-line t
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-agenda-tags-column -80
 org-pomodoro-long-break-length 25
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-refile-targets '((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9))
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-pretty-entities t
 org-edit-src-content-indentation 0
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-agenda-files
'("/home/BigHome/Documents/org/Estudo/Unifacs/PrimeiroSemestre/Matérias/Algoritmos/Algs/Listas/
new_steps.org"
"/home/BigHome/Documents/org/Estudo/Unifacs/PrimeiroSemestre/Matérias/Algoritmos/Algs/Listas/
etapas.org" "~/org/Compromissos/day.org" "~/org/Compromissos/tomorrow.org"
"/home/BigHome/Documents/org/Notes/Clarice/clarice.org" "~/.emacs.d/init.org"
"~/org/day.org")
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-clock-report-include-clocking-task t
 org-tag-alist '((:startgroup) ("@org" . 111) ("@unif" . 117) ("@blog" .
110)
("@fami" . 102) ("@heal" . 115) ("@tech" . 116) ("@grph" . 116)
("@prog" . 112) ("@emcs" . 101) ("@home" . 104) (:endgroup))
 org-allow-promoting-top-level-subtree t
 org-archive-location "~/org/Archive/archive.org::"
 org-mode-hook '(evil-org-mode org-bullets-mode org-clock-load
electric-pair-local-mode
toc-org-enable
#[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-eldoc-load)
 org-clock-persist t
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-outline-path-complete-in-steps nil
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-startup-indented t
 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-cliplink-max-length 60
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.jpg\\'" . "viewnior %s") ("\\.pdf\\'" . "zathura %s"))
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-hide-emphasis-markers t
 org-clock-in-resume t
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-ellipsis "."
 org-clock-x11idle-program-name "xprintidle"
 org-src-preserve-indentation t
 org-fontify-done-headline t
 org-pomodoro-short-break-length 10
 org-occur-hook '(org-first-headline-recenter)
 org-agenda-mode-hook '((lambda nil (setq display-line-numbers nil) (setq
truncate-lines t)))
 org-pomodoro-ticking-sound
"~/.emacs.d/elpa/org-pomodoro-20171108.2114/resources/tick.wav"
 org-structure-template-alist '(("el" "#+BEGIN_SRC emacs-lisp :tangle
yes\n?\n#+END_SRC")
("use"
"#+BEGIN_SRC emacs-lisp :tangle yes\n(use-package ?\n:ensure t)\n#+END_SRC")
("ll"
"\\begin{equation*}\n\\begin{split}\n?\n\\end{split}\n\\end{equation*}")
("py" "#+BEGIN_SRC python :tangle yes\n?\n#+END_SRC")
("sh" "#+BEGIN_SRC shell :tangle yes\n?\n#+END_SRC")
("cc" "#+BEGIN_SRC C\n?\n#+END_SRC")
("s" "#+BEGIN_SRC ?\n\n#+END_SRC")
("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE")
("v" "#+BEGIN_VERSE\n?\n#+END_VERSE")
("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM")
("c" "#+BEGIN_CENTER\n?\n#+END_CENTER")
("C" "#+BEGIN_COMMENT\n?\n#+END_COMMENT")
("l" "#+BEGIN_EXPORT latex\n?\n#+END_EXPORT")
("L" "#+LaTeX: ")
("h" "#+BEGIN_EXPORT