Re: [O] org-protocol documentation

2017-06-23 Thread Mario Martelli
Hi,

> Am 22.06.2017 um 22:03 schrieb Nicolas Goaziou :
> 
> So as to ease the reviewing process, could you send it on the ML with
> git format-patch sub-command?
> 

sure. I would like to add an example using the subprotocol “open-source” for 
hugo. If that sounds ok for you.
For that I would need “open-source” working, of course.

> Also, I suggest using ox-texinfo from development version, if you can,
> as the Texinfo output should be superior.

have to set that up first. But I think I will need it anyway. ;)

>>> I assume a bug around Line 527 in org-protocol.el
>>> 
>>>  (let* ((base-url (plist-get (cdr prolist) :base-url))
>>> —>   (wsearch (regexp-quote base-url)))   <—
>>> 
>>> Could anyone confirm that? I’m unsure whether it might be a local 
>>> misconfiguration on my side or not.
> 
> Confirm what?

That “open-source" is not working and is failing silently.

> Why do you think there is a bug in the line above?

Because I’m not experienced with elisp ;)

I dug a little deeper and do now assume that there *might* be something wrong 
with “f” which is created in line 523

(f (plist-get (org-protocol-parse-parameters fname nil '(:url)) :url)))

and which has “http:” as value if I’m using old style URIs and the whole URL 
(“http:/orgmode.org/worg/org-tutorials/org-import-rtm.html 
” in my example) if 
I’m using new style URIs.
I assume “f” should be set to the base-url ("http:/orgmode.org/worg/ 
“ in my case). 

Given that, the test in line 529 

(when (string-match wsearch f)

fails all the time causing the function to fail silently.

Thank you for being patient with me. At the moment I’m seeing parenthesises and 
backslashes everywhere :)

Kind regards
Mario
— 




Re: [O] org table toggle narrowing and true column hiding

2017-06-23 Thread Uwe Brauer

> Hello,
> Uwe Brauer  writes:


> What is true column hiding? What is the question you are referring to?

Most of the spreadsheet application I know allow you 

-  to mark a column 

-  and to hide it (it is still there and can be displayed of course)

That question was asked for example in
https://www.reddit.com/r/emacs/comments/2blff3/is_it_possible_to_hide_some_columns_from_an_org

I now that I can hide regions in emacs but I am not sure about rectangles.

> I don't understand your question.



-  Well part one:

Original table


| Name | Passport | other |
|  |  <2> |   |
| Joe  |   123456 |   |
| John |   456789 |   |



-  part two: narrow the second column


| Name | =>> | other |
|  | =>> |   |
| Joe  | =>> |   |
| John | ==> |   |


-  part three missing: how can I recover the original table (something like
   widening)?





The only solution I came up with is rather  cumbersome

(defun org-table-turn-narrowing-off ()
  (interactive)
  (setq org-table-do-narrow nil)
  (message "Now table narrowing is off!"))

(defun org-table-turn-narrowing-on ()
  (interactive)
  (setq org-table-do-narrow t)
  (message "Now table narrowing is on!"))

(defun org-table-toggle-narrowing ()
"Toggle function between New subject is in same thread or not."
  (interactive)
  (make-repeat-command 'org-table-toggle-narrowing
  '(org-table-turn-narrowing-on
org-table-turn-narrowing-off)))

Turning narrowing of and run C-c C-c again.

I hope there are more comfortable solutions.

Uwe Brauer 





Re: [O] rounding (up)

2017-06-23 Thread Uwe Brauer

   > Uwe Brauer  writes:


   > (info "(calc) Integer Truncation") has


   > So I suggest the following:

   > | 3.25 | |
   > |  6.5 | |

   > #+TBLFM: $2=round($1*0.15,2);%.2f

That is cool as well




Re: [O] [PATCH] noweb documentation update

2017-06-23 Thread Kaushal Modi
On Fri, Jun 23, 2017, 1:56 AM Nicolas Goaziou 
wrote:

>
> Sure, go ahead. Thank you.
>

Thanks, done.

> --

Kaushal Modi


[O] [bug] org-indent

2017-06-23 Thread Rasmus
Hi,

There's a bug in ‘org-indent--compute-prefixes’ near ";; Inline tasks line
prefixes".

If (bound-and-true-p org-inlinetask-show-first-star) is non-nil, then Org
tries to compute (substring heading-prefix 1).  But the initial value of
‘heading-prefix’ seems to be "", at least some of the time (if
‘indentation’ is 0).  In my Emacs this results in an error. 

Adding an extra check seems to fix it, but I’m not sure if the substring
part is what needs fixing.

;; Inline tasks line prefixes
(aset org-indent--inlinetask-line-prefixes
  n
  (org-add-props (if (and (bound-and-true-p 
org-inlinetask-show-first-star)
  (org-string-nw-p heading-prefix))
 (concat org-indent-inlinetask-first-star
 (substring heading-prefix 1))
   heading-prefix)
  nil 'face 'org-indent)))


Thanks,
Rasmus

-- 
Dung makes an excellent fertilizer




[O] [bug?] org-inside-latex-fragment-p broken?

2017-06-23 Thread Rasmus
Hi,

org-inside-LaTeX-fragment-p seems to assume that a latex-fragment only
exists beyond the first paragraph.  It does fails to predict the fragment
in this simple file

#+begin_src org
foo $x$ bar
test `org-inside-LaTeX-fragment-p' on the "$x$" above.
#+end_src

It seems to be fixed if we replace,

(lim (progn
 (re-search-backward (concat "^\\(" paragraph-start "\\)") nil 
t)
 (point)))

With

(lim (save-excursion (backward-paragraph) (point)))

Should I push this?

Thanks,
Rasmus

-- 
You people at the NSA are becoming my new best friends!




Re: [O] [bug] org-indent

2017-06-23 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> There's a bug in ‘org-indent--compute-prefixes’ near ";; Inline tasks line
> prefixes".
>
> If (bound-and-true-p org-inlinetask-show-first-star) is non-nil, then Org
> tries to compute (substring heading-prefix 1).  But the initial value of
> ‘heading-prefix’ seems to be "", at least some of the time (if
> ‘indentation’ is 0).  In my Emacs this results in an error.

You're right. I fixed the issue, along with another one, which was
preventing fontification from first star in that case.

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [bug?] org-inside-latex-fragment-p broken?

2017-06-23 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> org-inside-LaTeX-fragment-p seems to assume that a latex-fragment only
> exists beyond the first paragraph.  It does fails to predict the fragment
> in this simple file
>
> #+begin_src org
> foo $x$ bar
> test `org-inside-LaTeX-fragment-p' on the "$x$" above.
> #+end_src
>
> It seems to be fixed if we replace,
>
> (lim (progn
>(re-search-backward (concat "^\\(" paragraph-start "\\)") nil 
> t)
>(point)))
>
> With
>
> (lim (save-excursion (backward-paragraph) (point)))
>
> Should I push this?

`backward-paragraph' may be a bit heavy.

Anyway we shouldn't use this function at all. Why do you need it?

Regards,

-- 
Nicolas Goaziou



Re: [O] [bug?] org-inside-latex-fragment-p broken?

2017-06-23 Thread Rasmus
Nicolas Goaziou  writes:

> `backward-paragraph' may be a bit heavy.
>
> Anyway we shouldn't use this function at all. Why do you need it?

It's used by a couple of org-cdlatex-* functions,
e.g. org-cdlatex-math-modify.

Rasmus

-- 
Vote for proprietary math!



Re: [O] [bug?] org-inside-latex-fragment-p broken?

2017-06-23 Thread Nicolas Goaziou
Rasmus  writes:

> Nicolas Goaziou  writes:
>
>> `backward-paragraph' may be a bit heavy.
>>
>> Anyway we shouldn't use this function at all. Why do you need it?
>
> It's used by a couple of org-cdlatex-* functions,
> e.g. org-cdlatex-math-modify.

Then these calls should be replaced with `org-element-context', unless
the callers may be used in partially written LaTeX snippets.

Regards,



Re: [O] empty cells in columns should be left emtpy when manipulating columns

2017-06-23 Thread Michael Brand
Hi Uwe

On Thu, Jun 22, 2017 at 9:56 AM, Uwe Brauer  wrote:

> #+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15;%.1f);E
>
> And friends did not work any more
>
> | 3.25 | 0.5) |
> |  | 0.0) |
> #+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15;%.1f);E

This is invalid syntax, what you meant would be:

| 3.25 | 0.5 |
|  | 0.0 |
#+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15);E %.1f

To preserve empty columns when reformatting you can use the Calc
formatter:

| 3.25 | 0.5 |
|  | |
#+TBLFM: $2=if("$1" == "nan", string(""), $1*0.15);E f-1

(info "(org) Formula syntax for Calc")

`if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1'
  Sum of the first two columns.  When at least one of the input
  fields is empty the Org table result field is set to empty.  `E'
  is required to not convert empty fields to 0.  `f-1' is an
  optional Calc format string similar to `%.1f' but leaves empty
  results empty.

See also
"Which float format shows the fraction part also when the latter is
zero?"
http://orgmode.org/worg/org-faq.html#table-float-fraction

Michael



Re: [O] org table toggle narrowing and true column hiding

2017-06-23 Thread Michael Brand
Hi Uwe

On Wed, Jun 21, 2017 at 11:24 AM, Uwe Brauer  wrote:

> Any plans to implement true column hiding for org tables?

Not that I know of. How would you select a hidden column to unhide it?

> Concerning narrowing (poor man version of hiding)
>
> | Name | passport | Other |
> |  | <2>  |   |
> | John Doe |  1234567 |   |

This is a good idea for your use case.

> The question is simple: how can a toggle narrowing?

To view all columns at once you can temporarily "C-c SPC C-c C-c" on
<2> and double undo.

To view only one field at a time and optionally edit it you can use
"C-c `" with zero, one or -- the coolest -- two C-u prefixes:

(info "(org) Built-in table editor")

`C-c ` (`org-table-edit-field')'
  Edit the current field in a separate window.  This is useful for
  fields that are not fully visible (*note Column width and
  alignment::).  When called with a `C-u' prefix, just make the full
  field visible, so that it can be edited in place.  When called
  with two `C-u' prefixes, make the editor window follow the cursor
  through the table and always show the current field.  The follow
  mode exits automatically when the cursor leaves the table, or when
  you repeat this command with `C-u C-u C-c `'.

Michael



Re: [O] [bug?] org-inside-latex-fragment-p broken?

2017-06-23 Thread Carsten Dominik
On Fri, Jun 23, 2017 at 9:45 AM, Nicolas Goaziou 
wrote:

> Rasmus  writes:
>
> > Nicolas Goaziou  writes:
> >
> >> `backward-paragraph' may be a bit heavy.
> >>
> >> Anyway we shouldn't use this function at all. Why do you need it?
> >
> > It's used by a couple of org-cdlatex-* functions,
> > e.g. org-cdlatex-math-modify.
>
> Then these calls should be replaced with `org-element-context', unless
> the callers may be used in partially written LaTeX snippets.
>

Yes, these can be used in partially written fragments.

Carsten


Re: [O] org-protocol documentation

2017-06-23 Thread Mario Martelli
Hi,

> fails all the time causing the function to fail silently.


I got "open-source" working by sanitising the URI before it is processed.


diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 825435674..7e986a9ed 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -520,7 +520,7 @@ The location for a browser's bookmark should look like this:
   ;; As we enter this function for a match on our protocol, the return value
   ;; defaults to nil.
   (let ((result nil)
-(f (plist-get (org-protocol-parse-parameters fname nil '(:url)) :url)))
+   (f (org-protocol-sanitize-uri (plist-get (org-protocol-parse-parameters 
fname nil '(:url)) :url
 (catch 'result
   (dolist (prolist org-protocol-project-alist)
 (let* ((base-url (plist-get (cdr prolist) :base-url))



Unfortunately it is still failing for old-style URIs. Fixing that would exceed 
my abilities.

I could document that "open-source" does only support new-style URIs. Not sure 
if that is the best solution.

Kind regards
Mario
— 




Re: [O] [bug?] org-inside-latex-fragment-p broken?

2017-06-23 Thread Nicolas Goaziou
Hello,

Carsten Dominik  writes:

> Yes, these can be used in partially written fragments.

OK. Does it make sense to use them outside of any fragment? For example,
you don't need to be in a LaTeX fragment to insert \alpha.

Regards,

-- 
Nicolas Goaziou0x80A93738



[O] [PATCH] doc/Makefile: Auto-generate org-version.tex for orgcard

2017-06-23 Thread Kyle Meyer
Hello,

It seems that the only place where we hardcode the Org version is
orgcard.tex.  Any objections to auto-generating this as well?

-- >8 --
* doc/Makefile: Add rule to generate org-version.tex.
* doc/orgcard.tex: Include org-version.tex rather than explicitly
setting version and year.

This removes the only instance in the repo where the Org version is
hardcoded.
---
 .gitignore  |  1 +
 doc/Makefile| 11 +--
 doc/orgcard.tex |  4 +---
 mk/targets.mk   |  1 +
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 70980cede..68d94d595 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ org
 org-loaddefs.el
 org-version.el
 doc/org-version.inc
+doc/org-version.tex
 org-*.tar*
 orgplus-*.tar*
 org-*.zip
diff --git a/doc/Makefile b/doc/Makefile
index 2c8a3c58c..87f8c2781 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -33,13 +33,20 @@ org-version.inc:org.texi
@echo "@set VERSION $(ORGVERSION) ($(GITVERSION))" >> org-version.inc
@echo "@set DATE $(DATE)" >> org-version.inc
 
+org-version.tex:   orgcard.tex
+   @echo "org-version: $(ORGVERSION) ($(GITVERSION))"
+   @echo "% automatically generated, do not edit"  > org-version.tex
+   @echo "\def\orgversionnumber{$(ORGVERSION)}" >> org-version.tex
+   @echo "\def\versionyear{$(YEAR)}" >> org-version.tex
+   @echo "\def\year{$(YEAR)}" >> org-version.tex
+
 install:   org
if [ ! -d $(DESTDIR)$(infodir) ]; then $(MKDIR) $(DESTDIR)$(infodir); 
else true; fi ;
$(CP) org $(DESTDIR)$(infodir)
$(INSTALL_INFO) --infodir=$(DESTDIR)$(infodir) org
 
 clean:
-   $(RM) org *.pdf *.html *_letter.tex org-version.inc \
+   $(RM) org *.pdf *.html *_letter.tex org-version.inc org-version.tex \
  *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs \
  *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps
 cleanall:  clean
@@ -59,7 +66,7 @@ clean-install:
 %.pdf: LANG=C
 %.pdf: %.texi org-version.inc
$(TEXI2PDF) $<
-%.pdf: %.tex
+%.pdf: %.tex org-version.tex
PDFLATEX=$(PDFTEX) $(TEXI2PDF) $<
 
 %.html:%.texi org-version.inc
diff --git a/doc/orgcard.tex b/doc/orgcard.tex
index 7f300633f..9659c5b4b 100644
--- a/doc/orgcard.tex
+++ b/doc/orgcard.tex
@@ -1,7 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{9.0.4}
-\def\versionyear{2017}  % latest update
-\def\year{2017} % latest copyright year
+\input org-version.tex
 
 %**start of header
 \newcount\columnsperpage
diff --git a/mk/targets.mk b/mk/targets.mk
index 0ccb6eafb..de4b8b861 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -20,6 +20,7 @@ else
   ORGVERSION ?= N/A
 endif
 DATE  = $(shell date +%Y-%m-%d)
+YEAR  = $(shell date +%Y)
 ifneq ($(GITSTATUS),)
   GITVERSION := $(GITVERSION:.dirty=).dirty
 endif
-- 
2.13.1





Re: [O] org table toggle narrowing and true column hiding

2017-06-23 Thread Uwe Brauer
>>> "Michael" == Michael Brand  writes:

   > Hi Uwe
   > On Wed, Jun 21, 2017 at 11:24 AM, Uwe Brauer  wrote:

   >> Any plans to implement true column hiding for org tables?

   > Not that I know of. How would you select a hidden column to unhide it?

Similar as in LO/OO excel and friends, I would need to have
org-table-toggle-coordinate-overlays on
and so columns are indicated by $1, $2 etc
and hidden columns would correspond to missing numbers

|$1-+|$6

so $2, $3 $4 $5 are hidden

   > To view only one field at a time and optionally edit it you can use
   > "C-c `" with zero, one or -- the coolest -- two C-u prefixes:


That is indeed cool thanks

Uwe 




[O] org-git-link 's open function org-git-open does not work correctly

2017-06-23 Thread numbch...@gmail.com
When I `org-store-link` in a local git repository file buffer, I got this
link:

[[git:~/.emacs.d/init/org-mode/init-my-org-hyperlink.el::develop@
{2017-06-24}::202][git:~/.emacs.d/init/org-mode/init-my-org-hyperlink.el::develop@
{2017-06-24}::202]]

Then I insert link into Org-mode buffer.
But when I open link with `[C-c C-o]`, it open git revision:
```
"/tmp/org-git-8fd5f4cf5d17479ead7b4329024860e84b6f2453/init-my-org-hyperlink.el"
```
This is not correct.
My current `HEAD` (command: `git show HEAD`) is:
```
commit 3cc7ee1792a7d7b8ddf51897f7b968af36bae745 (HEAD -> develop)
```

[stardiviner] GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/