Re: [O] org: Fix tag width calculation for multi-column chars

2016-05-31 Thread Georgiy Tugai
On 31 May, Samuel Wales wrote:
> i wonder if this also fixes tags for variable pitch (proportional)
> fonts.  i have been having great success with variable pitch fonts and
> it would be great if this fixes tags for them too.
> 
> -- 
> The Kafka Pandemic: http://thekafkapandemic.blogspot.com
> 
> The disease DOES progress.  MANY people have died from it.  And
> ANYBODY can get it.
> 
> Denmark: free Karina Hansen NOW.
> 

I'm not sure if this is the right place to ask, but would it be possible
to implement, for lack of better terms, "virtual" tag positioning? In
other words, the tags in the actual file are placed as usual
(org-tags-column), but if a new variable (say, org-tags-column-display)
is set, an overlay is placed onto each tag which results in the tags
being shown at that location rather than where they actually are in the
line?

I understand that this violates "what you see is what is in the file";
however, this would allow (I believe) easier handling of windows where
org-tags-column is wider than the window, as well as variable font sizes
(f.e. some themes use large font sizes for headings, which interferes
with tag positioning).

If this can be done and doesn't violate any of Org's design principles,
I would appreciate some pointers on where to hook into Org to implement
such a mechanism.

Regards,
Georgiy


signature.asc
Description: PGP signature


Re: [O] Bug: imenu and eldoc breadcrumb false-positive match non-uppercase todo keywords

2016-05-31 Thread Nicolas Goaziou
Hello,

Georgiy Tugai  writes:

> Steps to reproduce
> ==
>
>   1) Org file with at least one first-level heading containing a TODO
>  keyword, with at least one of it's letters lowercased.
>
>   2) Rescan imenu, look at it's contents
>
>   3) Put point on the heading with lowercased TODO keyword, look at the
>  eldoc breadcrumb
>
>
> Expected behaviour
> ==
>
>   In a manner consistent with the rest of Org (font-locking, C-c C-t,
>   etc.), TODO keywords which are not all uppercase are treated as normal
>   text.
>
>   If the heading is "* Todo list", imenu should show "Todo.list" and the
>   eldoc breadcrumb should show "Todo list".
>
>
> Actual behaviour
> 
>
>   Imenu shows "list", eldoc breadcrumb shows "list" -- as if "Todo" is a
>   TODO keyword, even though it is not font-locked as such, or treated as
>   a keyword by other parts of Org (such as the agenda).

Fixed (at least for imenu). Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] org-mode 8.3.x directly opens URL/ follows Timestamp, if Return is clicked

2016-05-31 Thread Nicolas Goaziou
Hello,

Matt Lundin  writes:

> Unfortunately, that commit must have been applied only to the master
> branch, as it is not present in the maint branch and thus was not
> released as part of org-mode 8.3.4. I'm not sure why that commit was
> never merged into maint. I'm flagging this as a bug to ensure that it is
> merged.

I don't remember the details. It probably introduces some subtle
user-visible changes. In any case, I'll cherry-picked it into master.
We'll see.


Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] error with org-refile and ido-completion-help

2016-05-31 Thread Matt Lundin
Nicolas Goaziou  writes:

>> A git bisect revealed that the change was introduced in 2015 with the
>> following commit:
>>
>> ,
>> | commit 50ba0a5ed609f3600f2590f3ba22b8ab3ff3331c
>> | Author: Nicolas Goaziou 
>> | Date:   Sun Jun 7 00:38:58 2015 +0200
>> | 
>> | Fix 1a7364177046b8a57ade0aeb9f52bacfc0b8b088
>> | 
>> | * lisp/org.el (org-icompleting-read): Let `completing-read' or
>> |   equivalent sort out type of completion.
>> | (org-olpath-completing-read): Revert partially
>> | 1a7364177046b8a57ade0aeb9f52bacfc0b8b088.
>> `
>>
>> It looks like this commit removed some functionality from the now
>> obsolete org-icompleting-read that made sure that the items in the
>> completion list passed to the completing read function were strings.
>
> Actually, this is a bug in "ido.el", since `ido-completing-read' is not
> a drop-in replacement for `completing-read'.  The latter accepts lists
> of strings, but also alist, obarrays and hash tables. The former accepts
> only list of strings.
>
> I suggest to report the bug to "ido.el" maintainers since they probably
> want to preserve compatibility between the completion functions.

OK. Thanks. I see that a bug report has been on the emacs list since
2013: 

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15430

For the time being, it's easy enough to write a custom wrapper around
ido-completing-read, so I think I'll do that.

It's worth nothing that the author of patch that originally added the
completing-read-function variable did not anticipate that
ido-completing-read would be a simple drop-in for completing-read:

http://thread.gmane.org/gmane.emacs.devel/134000

For a long time (since at least 2009), org-mode had built-in support for
ido-mode completion when refiling. So this does seem to be a deprecation
of longstanding org-mode functionality.

I'll see if we can add something to the docstrings to alert of the need
to write a wrapper around ido-completing-read.

Matt



Re: [O] [PATCH] org: Fix tag width calculation for multi-column chars

2016-05-31 Thread Samuel Wales
i wonder if this also fixes tags for variable pitch (proportional)
fonts.  i have been having great success with variable pitch fonts and
it would be great if this fixes tags for them too.

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.



Re: [O] PATCH: ox: Starting source code export at non-zero (-n value)

2016-05-31 Thread Nicolas Goaziou
Hello,

Brian Carlson  writes:

> Should I have made the changes to contrib/orgmanual.org rather than
> doc/org.texi. Or should I have made changes to both?

Changes to both is fine.

I applied your patch. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] BUG: in beamer export non-beamer tags exported as part of header

2016-05-31 Thread John Hendy
On Fri, May 27, 2016 at 11:15 AM, Rainer M Krug  wrote:
> Nicolas Goaziou  writes:
>
>> Hello,
>>
>> Rainer M Krug  writes:
>>
>>> When I generate a pdf, the tags are in the TOC - but tags:not-in-toc
>>> means that the tags are *not* in the toc - possibly only in the headers
>>> itself? I don't know.
>>>
>>> Just checked, the tags are also in the toc in html export.
>>>
>>> According to the documentation:
>>>
>>> ,
>>> | If this is the symbol ‘not-in-toc’, tags will be removed from
>>> | table of contents entries, but still be shown in the headlines of
>>> | the document.
>>> `
>>>
>>> This is not working anymore.
>>
>> I cannot reproduce it, at least on HTML, LaTeX, and ASCII export. Could
>> you show an ECM ?
>
> OK. Here it is:
>
> --8<---cut here---start->8---
> #+TITLE: An Example
> #+EMAIL: rai...@krugs.de
>
> #+OPTIONS:   tags:not-in-toc
>
> #+LATEX_CLASS: beamer
> #+OPTIONS:   H:2 toc:t
>
> * Level 1   :andHereIsTheTag:
> ** A Frame
> #+begin_example
> Org-mode version 8.3.4 (release_8.3.4-850-g9dbeaa @ 
> /Users/rainerkrug/.emacs.d/org-mode/lisp/)
> GNU Emacs 25.0.94.1 (x86_64-apple-darwin15.4.0, Carbon Version 157 AppKit 
> 1404.46) of 2016-05-24
> #+end_example
> --8<---cut here---end--->8---
>
>
> The problem is beamer - with the other exports it works. With beamer,
> I get the pdf at [[https://www.dropbox.com/s/fc6z9wszxl5vv9i/text.pdf?dl=0]]
>

As is, I get the tag in beamer, article, and html. You're saying you
*don't* get the tag in article/html, but you *do* in beamer? If so, I
can't reproduce. Behavior is consistent with what I'd expect, namely
that tags export, but setting tags:nil turns that off.


John

> Cheers,
>
> Rainer
>
>>
>> Regards,
>
> --
> Rainer M. Krug
> email: Rainerkrugsde
> PGP: 0x0F52F982



Re: [O] [PATCH] org: Fix tag width calculation for multi-column chars

2016-05-31 Thread Nicolas Goaziou
Hello,

Yasushi SHOJI  writes:

> Some characters have multiple column width.  Calculating string width
> with points gives a wrong value than actual display width.  Use
> `string-width' instead.
>
> Here is an ECM for this problem.  `M-x org-update-statistics-cookies` or
> `C-c #` on bar moves the tag on the headline.
>
> * foo [0/0]   :abc:
> ** child
> * bar [0/0]:日本語:
> ** child
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890
>  1 2 3 4 5 6 7
>  8
>
> Simple test case is also included.

Thank you.

> Let me know if I miss something.

Could you send it again with an appropriate commit message and using git
format-patch?

Also, there is already a "Tags" section in "test-org.el". Could you add
your tests there instead of creating a new section?

Regards,

-- 
Nicolas Goaziou



Re: [O] BUG: in beamer export non-beamer tags exported as part of header

2016-05-31 Thread Nicolas Goaziou
Hello,

Rainer M Krug  writes:

> OK. Here it is:
>
> #+TITLE: An Example
> #+EMAIL: rai...@krugs.de
>
> #+OPTIONS:   tags:not-in-toc
>
> #+LATEX_CLASS: beamer
> #+OPTIONS:   H:2 toc:t
>
> * Level 1   :andHereIsTheTag:
> ** A Frame
> #+begin_example
> Org-mode version 8.3.4 (release_8.3.4-850-g9dbeaa @ 
> /Users/rainerkrug/.emacs.d/org-mode/lisp/)
> GNU Emacs 25.0.94.1 (x86_64-apple-darwin15.4.0, Carbon Version 157 AppKit 
> 1404.46) of 2016-05-24
> #+end_example
>
>
> The problem is beamer - with the other exports it works. With beamer,
> I get the pdf at [[https://www.dropbox.com/s/fc6z9wszxl5vv9i/text.pdf?dl=0]]

I cannot reproduce it. Could you show the LaTeX code generated?

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] error with org-refile and ido-completion-help

2016-05-31 Thread Nicolas Goaziou
Hello,

Matt Lundin  writes:

> When calling org-refile with org-completion-use-ido set to t, pressing
> TAB in ido-mode results in an error. This is because ido-completion-help
> expects a list of strings. However, org-refile sends ido-completing-read
> a list of lists.
>
> To replicate:
>
> 1. /usr/bin/emacs -Q -l ~/.minimal.el
>
> (add-to-list 'load-path "~/org-mode/lisp")
> (add-to-list 'load-path "~/org-mode/contrib/lisp")
> (ido-mode)
> (setq org-completion-use-ido 1)
>
> Go to an org file with headlines:
>
> * One * Two * Three
>
> 2. Call org-refile on the first headline.
>
> 3. Press TAB within the ido minibuffer. (See the backtrace at the bottom
> of this post).
>
> A git bisect revealed that the change was introduced in 2015 with the
> following commit:
>
> ,
> | commit 50ba0a5ed609f3600f2590f3ba22b8ab3ff3331c
> | Author: Nicolas Goaziou 
> | Date:   Sun Jun 7 00:38:58 2015 +0200
> | 
> | Fix 1a7364177046b8a57ade0aeb9f52bacfc0b8b088
> | 
> | * lisp/org.el (org-icompleting-read): Let `completing-read' or
> |   equivalent sort out type of completion.
> | (org-olpath-completing-read): Revert partially
> | 1a7364177046b8a57ade0aeb9f52bacfc0b8b088.
> `
>
> It looks like this commit removed some functionality from the now
> obsolete org-icompleting-read that made sure that the items in the
> completion list passed to the completing read function were strings.

Actually, this is a bug in "ido.el", since `ido-completing-read' is not
a drop-in replacement for `completing-read'.  The latter accepts lists
of strings, but also alist, obarrays and hash tables. The former accepts
only list of strings.

I suggest to report the bug to "ido.el" maintainers since they probably
want to preserve compatibility between the completion functions.

Regards,

-- 
Nicolas Goaziou



Re: [O] Tags management strategies

2016-05-31 Thread Martin Leduc

On 05/17/2016 08:23 AM, Karl Voit wrote:

David Weinberger

Hi Karl,

Thank you so much for these interesting resources. I've read your 
technique for tagging files and folders and must admit that it's quite 
impressing. I would love to implement such kind of a system one day 
along with my GTD set-up, but I'm unfortunately lacking time for such a 
project at the moment.


I found your suggestion of using file-specific tags very interesting 
because it simplifies a lot of things. For example, rather than using 
grouptags in a global list, I can use file-specific tags. That way each 
file can represent a specific context, with a group of tags associated 
with it. Used along with capture templates, this can become powerful, as 
I can press C-q and then TAB to display an ordered list of all tags 
related to that context.


Using file-specific tags allowed me to simplify my org-tag-alist to 5 
tags (HOME,WORK,MAIL,CALL,READ), which can be added to any file-specific 
list without any problems since, as you said, context-related lists of 
tags overlap rather vaguely.


David Weinberger's book seems interesting. This is in agreement with 
Samuel Wales suggestion (see the other response to my first post) to 
make an extensive use of regexp searches (I need to invest some time for 
this).


At first I thought I was asking a simple and naive question about tags. 
Thanks for opening this interesting Pandora's box.


Martin




Re: [O] PATCH: ox: Starting source code export at non-zero (-n value)

2016-05-31 Thread Brian Carlson



On 2016-05-26 02:52, Nicolas Goaziou wrote:


I realize that the org texinfo manual probably needs to be updated, as well. 
I'll take a stab at updating that unless
someone else wants to take that on.


You're right. You can merge ORG-NEWS modifications into the
documentation patch.


I just realized. I the patch I submitted had modifications to doc/org.texi.

Should I have made the changes to contrib/orgmanual.org rather than 
doc/org.texi. Or should I have made changes to both?



Thanks,
;-b



Re: [O] Exported document does not open in associated application upon export completion (was Problem exporting to pdflatex)

2016-05-31 Thread Charles Millar

Hi,

I now realize that the exporter (pdflatex) does create the desired 
document; however upon completing the export the new pdf document does 
not immediately open, to which I am accustomed. I can open the pdf by 
going to the exported document itself, etc.


LMDE Betsy

GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5) of 
2016-05-26


Org-mode version 8.3.4 (release_8.3.4-872-g3d0ade @ 
/usr/local/share/emacs/site-lisp/org-mode/lisp/)


backtrace attached (org mode was reloaded, not compiled)

Charlie Millar

On 05/26/2016 07:44 PM, Charles Millar wrote:
Negleted to mention that the export to pdflatex worked fine with Emacs 
24 version included in LMDE Betsy.



On 05/26/2016 07:28 PM, Charles Millar wrote:

Hi,

I just upgraded via git to Emacs 25. My init file loads OK and 
everything "seems" to work, except:


Upon attempting to export to pdflatex following error results


snip

LMDE Betsy

GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5) 
of 2016-05-26


Org-mode version 8.3.4 (release_8.3.4-869-gf2c421 @ 
/usr/local/share/emacs/site-lisp/org-mode/lisp/)


Any help appreciated.

Charlie Millar









Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  file-truename(nil)
  find-file-noselect-1(#> 
"/mnt/Data/ActiveFiles/SomeoneFrank/SomeoneInventory.pdf" nil nil 
"/mnt/Data/ActiveFiles/SomeoneFrank/SomeoneInventory.pdf" (16840 2057))
  find-file-noselect("/mnt/Data/ActiveFiles/SomeoneFrank/SomeoneInventory.pdf" 
nil nil nil)
  
find-file-other-window("/mnt/Data/ActiveFiles/SomeoneFrank/SomeoneInventory.pdf")
  funcall(find-file-other-window 
"/mnt/Data/ActiveFiles/SomeoneFrank/SomeoneInventory.pdf")
  (cond ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) (while 
(string-match "['\"]%s['\"]" cmd) (setq cmd (replace-match "%s" t t cmd))) 
(while (string-match "%s" cmd) (setq cmd (replace-match (let 
((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data 
save-match-data-internal ...))) t t cmd))) (let ((save-match-data-internal 
(match-data))) (unwind-protect (progn (let ((match-index 1) (number-of-groups 
...)) (set-match-data link-match-data) (while (<= match-index number-of-groups) 
(let ... ...) (setq match-index ... (set-match-data 
save-match-data-internal (quote evaporate (let ((wconfig 
(current-window-configuration))) (unwind-protect (progn (message "Running 
%s...done" cmd) (start-process-shell-command cmd nil cmd) (and (boundp (quote 
org-wait)) (numberp org-wait) (sit-for org-wait))) (set-window-configuration 
wconfig ((or (stringp cmd) (eq cmd (quote emacs))) (funcall (cdr (assq 
(quote file) org-link-frame-setup)) file) (widen) (cond (line (org-goto-line 
line) (if (derived-mode-p (quote org-mode)) (progn (org-reveal (search 
(org-link-search search ((functionp cmd) (let ((save-match-data-internal 
(match-data))) (unwind-protect (progn (set-match-data link-match-data) 
(condition-case nil (funcall cmd file link) ((debug wrong-number-of-arguments 
wrong-type-argument invalid-function) (user-error "Please see Org News for 
version 9.0 about `org-file-apps'--Lisp error: %S" cmd (set-match-data 
save-match-data-internal (quote evaporate) ((consp cmd) (user-error "Please 
see Org News for version 9.0 about `org-file-apps'--Error: Deprecated usage of 
%S" cmd)) (t (funcall (cdr (assq (quote file) org-link-frame-setup)) file)))
  (let* ((file (if (equal path "") buffer-file-name (substitute-in-file-name 
(expand-file-name path (file-apps (append org-file-apps 
(org-default-apps))) (apps (cl-remove-if (quote 
org-file-apps-entry-match-against-dlink-p) file-apps)) (apps-dlink 
(cl-remove-if-not (quote org-file-apps-entry-match-against-dlink-p) file-apps)) 
(remp (and (assq (quote remote) apps) (org-file-remote-p file))) (dirp (if remp 
nil (file-directory-p file))) (file (if (and dirp 
org-open-directory-means-index-dot-org) (concat (file-name-as-directory file) 
"index.org") file)) (a-m-a-p (assq (quote auto-mode) apps)) (dfile (downcase 
file)) (link (cond (line (concat file "::" (number-to-string line))) (search 
(concat file "::" search)) (t file))) (dlink (downcase link)) (old-buffer 
(current-buffer)) (old-pos (point)) (old-mode major-mode) (ext (and 
(string-match "\\`.*?\\.\\([a-zA-Z0-9]+\\(\\.gz\\)?\\)\\'" dfile) (match-string 
1 dfile))) cmd link-match-data) (cond ((member in-emacs (quote ((16) system))) 
(setq cmd (cdr (assq (quote system) apps (in-emacs (setq cmd (quote 
emacs))) (t (setq cmd (or (and remp (cdr (assq ... apps))) (and dirp (cdr (assq 
... apps))) (let ((match ...)) (if match (progn ... match) (progn ... nil))) 
(assoc-default dfile (org-apps-regexp-alist apps a-m-a-p) (quote string-match)) 
(cdr (assoc ext apps)) (cdr (assq t apps)) (if (eq cmd (quote system)) 
(progn (setq cmd (cdr (assoc (quote system) apps) (if (eq cmd (quote 
default)) (progn (setq cmd (cdr (assoc t apps) (if (eq cmd (quote mailcap)) 
(progn (require (quote mailcap)) 

[O] Bug: imenu and eldoc breadcrumb false-positive match non-uppercase todo keywords

2016-05-31 Thread Georgiy Tugai
GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.3) of 2016-05-06 
on arojas

Org-mode version 8.3.4 (8.3.4-67-g610564-elpaplus @ 
~/.emacs.d/elpa/org-plus-contrib-20160523/)

Steps to reproduce
==

  1) Org file with at least one first-level heading containing a TODO
 keyword, with at least one of it's letters lowercased.

  2) Rescan imenu, look at it's contents

  3) Put point on the heading with lowercased TODO keyword, look at the
 eldoc breadcrumb


Expected behaviour
==

  In a manner consistent with the rest of Org (font-locking, C-c C-t,
  etc.), TODO keywords which are not all uppercase are treated as normal
  text.

  If the heading is "* Todo list", imenu should show "Todo.list" and the
  eldoc breadcrumb should show "Todo list".


Actual behaviour


  Imenu shows "list", eldoc breadcrumb shows "list" -- as if "Todo" is a
  TODO keyword, even though it is not font-locked as such, or treated as
  a keyword by other parts of Org (such as the agenda).


signature.asc
Description: PGP signature


[O] [PATCH] org: Fix tag width calculation for multi-column chars

2016-05-31 Thread Yasushi SHOJI
Some characters have multiple column width.  Calculating string width
with points gives a wrong value than actual display width.  Use
`string-width' instead.

Here is an ECM for this problem.  `M-x org-update-statistics-cookies` or
`C-c #` on bar moves the tag on the headline.

* foo [0/0] :abc:
** child
* bar [0/0]  :日本語:
** child
12345678901234567890123456789012345678901234567890123456789012345678901234567890
 1 2 3 4 5 6 7 8

Simple test case is also included.
---

Hello,

While using Japanese as a tag, it seems to move the position of it
when `org-align-tags-here' is called.

If Japanese characters are allowed for tags, please merge it.

Let me know if I miss something.

Thanks,
yashi


 lisp/org.el  |  2 +-
 testing/lisp/test-org.el | 23 +++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index e4edcf4..d34163f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14922,7 +14922,7 @@ If ONOFF is `on' or `off', don't toggle but set to this 
state."
 (if(and (looking-at (org-re ".*?\\([ 
\t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))
 (< pos (match-beginning 2)))
(progn
- (setq tags-l (- (match-end 2) (match-beginning 2)))
+ (setq tags-l (string-width (match-string 2)))
  (goto-char (match-beginning 1))
  (insert " ")
  (delete-region (point) (1+ (match-beginning 2)))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 73245b4..7de0fa0 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -4406,6 +4406,29 @@ Paragraph"
   (funcall list-visible-lines 'canonical nil)
 
 
+
+;;; Tags
+
+(ert-deftest test-org/tag-align ()
+  "Test `org-align-tags-here' with different display width."
+  (should
+   ;;  12345678901234567890
+   (equal "* Test :abc:"
+ (org-test-with-temp-text "* Test :abc:"
+   (let ((org-tags-column -20)
+ (indent-tabs-mode nil))
+(org-fix-tags-on-the-fly))
+   (buffer-string
+  (should
+   ;;  12345678901234567890
+   (equal "* Test  :日本語:"
+ (org-test-with-temp-text "* Test :日本語:"
+   (let ((org-tags-column -20)
+ (indent-tabs-mode nil))
+(org-fix-tags-on-the-fly))
+   (buffer-string)
+
+
 (provide 'test-org)
 
 ;;; test-org.el ends here
-- 
2.8.1