Re: [O] [PATCH] Feature proposal : support "scale=" includegraphics option in the builtin latex exporter.

2019-06-15 Thread Emmanuel Charpentier
Le mardi 23 avril 2019 à 10:26 +0200, Nicolas Goaziou a écrit :
> Hello,
> 
> Emmanuel Charpentier  writes:
> 
> > Le lundi 22 avril 2019 à 15:26 +0200, Nicolas Goaziou a écrit :
> > > Emmanuel Charpentier  writes:
> > > 
> > > > Do you want a direct answer or a partch against /etc/ORG-NEWS ?
> > > 
> > > Anything that suits you.
> > 
> > A patch it is (enclosed).
> 
> Applied. Thank you.

We are now on June 16. The ELPA-distributed org-plus-contrib still does
not carry these patches (re-attached, FWIW).

I have checked that they are present in the ~master~ branch of the
source tree, but not its ~maint~ branch.

Am I misunderstanding anything ?

--
Emmanuel Charpentier

> 
> > If this documentation is customaty, this should be mentioned in the
> > "Contribute" page of Worg (which, IMHO, should be pointed to by
> > the 
> > "Feedback" section of the manual).
> 
> Feel free to edit Worg, it is user-maintained. OTOH, I don' think the
> manual should rely on the wiki. We could, instead, augment
> "README_contribute".
> 
> Regards,
> 
From 2526a06e4f77a2fdae615a95365f557c40b6d968 Mon Sep 17 00:00:00 2001
From: Emmanuel Charpentier 
Date: Sat, 20 Apr 2019 10:25:24 +0200
Subject: [PATCH 1/2] Support a :scale parameter in org-latex-export-to-latex
 and friends

* lisp/ox-latex.el: introduce a :scale #+ATTR_LATEX parameter, as well
as a "" default value for it.  When present, it overrides :width and
:height parameters (as it does for ODT export and in ox-pandoc
exporters) ; therefore, setting a default value for :scale should be
exceptional.

Implementation: uses \scalebox for tikz/pgf images, "scale=" parameter
of \includegraphics in other cases.

* doc/org-manual.org: document the new :scale #+ATTR_LATEX parameter,
---
 doc/org-manual.org |  8 ++--
 lisp/ox-latex.el   | 49 ++
 2 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index a8f4a45ea..a9114184a 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13277,14 +13277,18 @@ insert the image.  But for TikZ (http://sourceforge.net/projects/pgf/)
 images, the back-end uses an ~\input~ macro wrapped within
 a ~tikzpicture~ environment.
 
-For specifying image =:width=, =:height=, and other =:options=, use
-this syntax:
+For specifying image =:width=, =:height=, =:scale= and other =:options=,
+use this syntax:
 
 #+begin_example
 ,#+ATTR_LATEX: :width 5cm :options angle=90
 [[./img/sed-hr4049.pdf]]
 #+end_example
 
+A =:scale= parameter overrides both =:width= and =:height= parameters ;
+therefore, setting its default value should be done only in exceptional
+circumstances.
+
 For custom commands for captions, use the =:caption= attribute.  It
 overrides the default =#+CAPTION= value:
 
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index cdcb07aca..60b8773b0 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -127,6 +127,7 @@
 (:latex-format-headline-function nil nil org-latex-format-headline-function)
 (:latex-format-inlinetask-function nil nil org-latex-format-inlinetask-function)
 (:latex-hyperref-template nil nil org-latex-hyperref-template t)
+(:latex-image-default-scale nil nil org-latex-image-default-scale)
 (:latex-image-default-height nil nil org-latex-image-default-height)
 (:latex-image-default-option nil nil org-latex-image-default-option)
 (:latex-image-default-width nil nil org-latex-image-default-width)
@@ -708,6 +709,17 @@ This value will not be used if a height is provided."
   :package-version '(Org . "8.0")
   :type 'string)
 
+(defcustom org-latex-image-default-scale ""
+  "Default scale for images.
+This value will not be used if a width or a scale is provided,
+or if the image is wrapped within a \"wrapfigure\",environment.
+Since scale overrides width and height, setting its default
+value should be done only in exceptional circumstances."
+  :group 'org-export-latex
+  :version "25.1"
+  :package-version '(Org . "9.2")
+  :type 'string)
+
 (defcustom org-latex-image-default-height ""
   "Default height for images.
 This value will not be used if a width is provided, or if the
@@ -2374,13 +2386,18 @@ used as a communication channel."
 	  (if (plist-member attr :center) (plist-get attr :center)
 	(plist-get info :latex-images-centered)))
 	 (comment-include (if (plist-get attr :comment-include) "%" ""))
-	 ;; It is possible to specify width and height in the
-	 ;; ATTR_LATEX line, and also via default variables.
-	 (width (cond ((plist-get attr :width))
+	 ;; It is possible to specify scale or width and height in
+	 ;; the ATTR_LATEX line, and also via default variables.
+	 (scale (cond ((eq float 'wrap) "")
+		  ((plist-get attr :scale))
+		  (t (plist-get info :latex-image-default-scale
+	 (width (cond ((org-string-nw-p scale) "")
+		  ((plist-get attr :width))
 		  ((plist-get attr :height) "")
 		  ((eq float 'wrap) "0.48\\textwidth")
 		  (t (plist-get info 

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

2019-06-15 Thread Bastien
Hi Gustav,

thanks a lot for your contribution!

Please register as a user on https://code.orgmode.org then send me
your username in a private email, I'll then add you to the list of
people with push access.

Thanks,

-- 
 Bastien



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

2019-06-15 Thread Nicolas Goaziou
Hello,

Gustav Wikström  writes:

> Some updates, and a fresh patch...!

Thank you.
>
> I won't say that much here since the patch speaks for itself (It 
> contains a chapter to be added to ORG-NEWS). It's patch 0002 that is the 
> important one. See sidenote below for a comment about patch 0001.
>
> I have to mention that the patch has grown quite a lot. With the 
> Additional changes, I've taken the liberty to promote attachments to a 
> level-1 headline within the documentation!

Hmm. I don't think it should be a top-level information. More on this below.

> Inheriting ID's for attachments is actually valuable. It makes it possible, 
> for example, to add attachment-links in subheadings to the node the  
> attachment is defined on. After having used this for quite some time now it
> feels quite natural to have inheritance switched on for attachments. No 
> negative
> side-effects at all.

OK.

> (Sidenote 1; what do I need to do to gain access to the official 
> git-repository? Would be nice to be able to provide pull requests there!)

Pull requests are not the preferred way to interact with the project.
However, I think you should have write access to the repository. I'm
Cc'ing Bastien about it, as I cannot do it myself.

> (Sidenote 2; The first patch is some minor unrelated fixups - it 
> breaks test-org-export/expand-include as a side-effect. But that's probably 
> because the test doesn't do what it should!  )

Probably. Yet, we should do something about it. If you cannot fix it, at
least please comment it out somehow.

>(should
> (equal
>  "1"
> -(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n** H2"
> -  (org-entry-get (point) "A" t
> +(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n** H2"
> +  (org-entry-get (point-max) "A" t

Not that it is wrong, but I don't see the benefit of this change.

>(should
> (equal
>  "1"
> -(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n** H2"
> +(org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n** H2"

Ditto.

>(let ((org-use-property-inheritance t))
> - (org-entry-get (point) "A" 'selective)
> + (org-entry-get (point-max) "A" 'selective)

Ditto.

>(should-not
> -   (org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n** H2"
> +   (org-test-with-temp-text "* H\n:PROPERTIES:\n:A: 1\n:END:\n** H2"
>   (let ((org-use-property-inheritance nil))
> -   (org-entry-get (point) "A" 'selective
> +   (org-entry-get (point-max) "A" 'selective

Ditto.

>  (defmacro org-test-with-temp-text-in-file (text  body)
> -  "Run body in a temporary file buffer with Org mode as the active mode."
> +  "Run body in a temporary file buffer with Org mode as the active mode.
> +If the string \"\" appears in TEXT then remove it and
> +place the point there before running BODY, otherwise place the
> +point at the beginning of the buffer."
>(declare (indent 1))
>(let ((results (cl-gensym)))
>  `(let ((file (make-temp-file "org-test"))
> @@ -207,6 +210,8 @@ otherwise place the point at the beginning of the 
> inserted text."
>  ,results)
> (with-temp-file file (insert inside-text))
> (find-file file)
> +   (when (re-search-forward "" nil t)
> +  (replace-match ""))
> (org-mode)
> (setq ,results (progn ,@body))
> (save-buffer) (kill-buffer (current-buffer))

While we're at fixing this macro, we may also wrap stuff within
`unwind-protect' so as to properly delete temporary files in any cases.

> From 0180a900f890b2053d8184116c99c62cfa083055 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Gustav=20Wikstr=C3=B6m?= 
> Date: Sun, 25 Nov 2018 21:38:44 +0100
> Subject: [PATCH 2/2] org-attach*, org, org-manual, org-news,
>  testing/**/test-org-attach*
>
> * org-attach.el
>
> Changed the way attachments deal with property-inheritance.  It now
> adheres to the =org-use-property-inheritance= setting by default but
> it can be customized if needed (I recommend to enable it!).
> The property ATTACH_DIR is depricated in favour of the shorter and simpler
> property DIR.

depricated -> deprecated

> * org-manual.org
>
> Attachments have been promoted into its own top-level node!  There are
> a lot of goodies to mention here that didn't fit naturally with
> "capture" and "archive" before.

This is true, but there is not enough information to require a top-level
node.

Here is a suggestion. Split "Capture, Refile, Archive" into two parts:

1. Refile, Copy and Archiving in one place, because they all relate to
   moving existing data around

2. Capture, Attachments, RSS Feeds, Protocols in another place, because
   they all insert external data to the system.

WDYT?

> +File links and attachment links can contain additional information to

Since attachment links are file links, it seems redundant to talk about
both everywhere. Just clarify clearly once that attachments links are
file links for all 

Re: [O] [PATCH] org-clock.el: Clear org-clock-current-task on clock cancel

2019-06-15 Thread Nicolas Goaziou
Hello,

m...@bcc32.com writes:

> From: "Aaron L. Zeng" 
>
> * org-mode/lisp/org-clock.el (org-clock-cancel): Clear
> `org-clock-current-task' when a clock is canceled.
>
> This variable is used by some mode line packages (e.g.,
> spaceline-all-the-icons), so not clearing the variable incorrectly
> displays the previous task as ongoing.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [ISSUE] source block coderef link does not work when not under same headline

2019-06-15 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> Here is an example, on first coderef link, it can work. But not work
> on second

What is "it"?

> same coderef link. Seems because of ~org-link-search~ can't search across 
> headline
> scope?
>
> #+begin_src org
> ,* Test coderef in source block
>
> ,#+begin_src emacs-lisp
> (print "hi") ; 
> (ref:kk)
> ,#+end_src
>
> [[(kk)]]
>
> ,* test across headline
>
> [[(kk)]]
> #+end_src

I cannot reproduce it: C-c C-o allows me to navigate back to the source block 
from any of these
links.

Regards,

-- 
Nicolas Goaziou



[O] [ISSUE] source block coderef link does not work when not under same headline

2019-06-15 Thread stardiviner


Here is an example, on first coderef link, it can work. But not work on second
same coderef link. Seems because of ~org-link-search~ can't search across 
headline
scope?

#+begin_src org
,* Test coderef in source block

,#+begin_src emacs-lisp
(print "hi")   ; 
(ref:kk)
,#+end_src

[[(kk)]]

,* test across headline

[[(kk)]]
#+end_src


-- 
[ stardiviner ]
   I try to make every word tell the meaning what I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
  



[O] Minibuffer popup for org-contacts contact linking?

2019-06-15 Thread Daryl Manning
I'm trying to figure out a way to hotkey bringing up a minibuffer in
ivy/ivy-rich much as I would with say `C-x b/k` for switching/killing
buffers, but allowing me to filter down to a contact and then, when
selected, have that put a `C-c l` link into a document for them.

Is there any way to do this? org-contacts documentation is light and while
there is a search function in there, having trouble bending it as much as
I'd like to my will (see previous message about a week's notice on
birthdays/anniversaries) though I like the fact it's nice and lightweight
and seems to do most of what I want within the workflow I've sort of
created for myself (
https://daryl.wakatara.com/a-better-gtd-and-crm-flow-for-emacs-org-mode )

Anyone have any idea or tips on how they've handled that?
thanks!
Daryl.


[O] Minibuffer popup for org-contacts contact linking?

2019-06-15 Thread Daryl Manning
I'm trying to figure out a way to hotkey bringing up a minibuffer in
ivy/ivy-rich much as I would with say `C-x b/k` for switching/killing
buffers, but allowing me to filter down to a contact and then, when
selected, have that put a `C-c l` link into a document for them.

Is there any way to do this? org-contacts documentation is light and while
there is a search function in there, having trouble bending it as much as
I'd like to my will (see previous message about a week's notice on
birthdays/anniversaries) though I like the fact it's nice and lightweight
and seems to do most of what I want within the workflow I've sort of
created for myself (
https://daryl.wakatara.com/a-better-gtd-and-crm-flow-for-emacs-org-mode )

Anyone have any idea or tips on how they've handled that?
thanks!
Daryl.