Re: When auto-fill breaks a link into multiple lines, the link is no longer displayed as a link

2020-09-06 Thread Philip Blagoveschensky
Do you mean that I can probably fix it by changing what fonts I use? If so, I'd 
rather do that than tinker with emacs trying to make a reproducible recipe.
-- 
Regards,

Philip Blagoveschensky

4 сент. 2020 г. 19:08:19 Bastien :

> Hi Philipp,
> 
> Philip Blagoveschensky  writes:
> 
>> Sometimes org-mode breaks links into multiple lines: sometimes
>> Auto-Fill   does this, sometimes me invoking org-fill-paragraph does
>> this. When it happens, org-mode displays them incorrectly, but only
>> after I reload the file (see the attached screenshot, there's a
>> newline symbol before the word "field"). How do I either
>> 
>> - Make it stop breaking links?
>> - Make it display them correctly even if they are broken?
> 
> I think I see what you mean, because I sometimes have broken links
> too, but would you care to provide a reproducible recipe, so that we
> can see what goes wrong when?  This is probably more due to an Emacs
> fontification limitation than an Org issue.
> 
> Thanks,
> 
> -- 
> Bastien
> 



When auto-fill breaks a link into multiple lines, the link is no longer displayed as a link

2020-07-22 Thread Philip Blagoveschensky
Sometimes org-mode breaks links into multiple lines: sometimes Auto-Fill 
 does this, sometimes me invoking org-fill-paragraph does this. When it 
happens, org-mode displays them incorrectly, but only after I reload the 
file (see the attached screenshot, there's a newline symbol before the 
word "field"). How do I either


- Make it stop breaking links?
- Make it display them correctly even if they are broken?

I've been told that they are supposed to be displayed as links even when 
multiline, and that something in my configuration must be broken. Does 
anyone know what causes this?


Emacs  : GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-23, modified by Debian
Package: Org mode version 9.3.6 (9.3.6-elpa @ 
/home/username/.emacs.d/elpa/org-9.3.6/)


Also, I use org-roam 1.2.0.
--
Regards,
Philip Blagoveschensky


org-attach-use-inheritance has incorrect :type 'boolean

2020-07-07 Thread Philip Blagoveschensky

This is the definition of org-attach-use-inheritance:


(defcustom org-attach-use-inheritance 'selective
  "Attachment inheritance for the outline.

Enabling inheritance for org-attach implies two things.  First,
that attachment links will look through all parent headings until
it finds the linked attachment.  Second, that running org-attach
inside a node without attachments will make org-attach operate on
the first parent heading it finds with an attachment.

Selective means to respect the inheritance setting in
`org-use-property-inheritance'."
  :group 'org-attach
  :type '(choice
  (const :tag "Don't use inheritance" nil)
  (const :tag "Inherit parent node attachments" t)
  (const :tag "Respect org-use-property-inheritance" selective))
  :type 'boolean)


As you can see, it can be either nil, t, or selective. However due to the

  :type 'boolean)

line, it's impossible to set it to selective using customize-variable.

Emacs  : GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-23, modified by Debian
Package: Org mode version 9.3.6 (9.3.6-elpa @ 
/home/username/.emacs.d/elpa/org-9.3.6/)




Re: Bug: org-babel python with :results value sends function definition with a statement after a for loop to the shell incorrectly [9.3.6 (9.3.6-elpa @ /home/username/.emacs.d/elpa/org-9.3.6/)]

2020-07-06 Thread Philip Blagoveschensky

Hi Ian,

>Do you have the same issue if you aren't using a session?

If I run the following code block (this time I am using python 3, so 
there are parens in the print line)


#+begin_src python
def foobar():
for i in range(5):
pass
print("hello world")
return 3

return foobar()
#+end_src

I get

#+RESULTS:
: 3

so I know it worked fine.

But if I add session like this:

#+begin_src python :session bug_report
def foobar():
for i in range(5):
pass
print("hello world")
return 3

return foobar()
#+end_src

then in *bug_report* I get

>>> def foobar():
... for i in range(5):
... pass
...
>>> print("hello world")
  File "", line 1
print("hello world")
^
IndentationError: unexpected indent
return 3
>>>
  File "", line 1
return 3
^
IndentationError: unexpected indent
>>> return foobar()
>>>
  File "", line 1
SyntaxError: 'return' outside function
>>> open('/tmp/babel-D0mRnD/python-CJ6UtT', 'w').write(str(_))
>>>
20
>>>
>>> 'org_babel_python_eoe'
>>> 'org_babel_python_eoe'
>>>

>Are you using tabs or spaces?

I used spaces. 4 spaces per indentation level, to be exact.

Also, FYI, as it might be relevant information, the shell buffer 
contents I posted above happen if the session has been created 
previously. If, instead, this is the first time I run some code in this 
session, then I also get another error - NameError (see below). Below 
you can see the contents of *bug_report* buffer if I run this code cell 
in a not-yet-existing session.


def foobar():
Python 3.8.2 | packaged by conda-forge | (default, Mar  5 2020, 17:11:00)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ... for i in range(5):
... pass
...
>>> print("hello world")
  File "", line 1
print("hello world")
^
IndentationError: unexpected indentreturn 3

>>>
  File "", line 1
return 3
^
IndentationError: unexpected indent
>>> return foobar()
>>>
  File "", line 1
SyntaxError: 'return' outside function
>>> open('/tmp/babel-D0mRnD/python-MsDjEk', 'w').write(str(_))
>>>
Traceback (most recent call last):
  File "", line 1, in 
NameError: name '_' is not defined
>>>
>>> 'org_babel_python_eoe'
>>> 'org_babel_python_eoe'
>>>

If you have a suggestion on how to debug this, feel free to tell.



Bug: org-babel python with :results value sends function definition with a statement after a for loop to the shell incorrectly [9.3.6 (9.3.6-elpa @ /home/username/.emacs.d/elpa/org-9.3.6/)]

2020-07-05 Thread Philip Blagoveschensky

Consider the following org-babel block:



#+begin_src python :session bug_report
def foobar():
for i in range(5):
pass
print "hello world"

foobar()
#+end_src



When I run it, this is what I see in the *bug_report* buffer:



def foobar():
... for i in range(5):
... pass
...
>>> print "hello world"
  File "", line 1
print "hello world"
^
IndentationError: unexpected indent

>>> foobar()
>>>
>>> open('/tmp/babel-MOOCF9/python-UW5PEF', 'w').write(str(_))
>>>
>>>
>>> 'org_babel_python_eoe'
>>> 'org_babel_python_eoe'
>>>



So, org-babel incorrectly decided that the line with the print is not a 
part of the function's definition and sent it to Python shell as a 
separate statement. Instead, it should've sent it as a part of foobar's 
definition.


This problem persists
- If I use python3 instead of python2
- If I replace
print "hello world"
  with
return 42

This problem disappears if I add :results output to the source block.


Emacs  : GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-23, modified by Debian
Package: Org mode version 9.3.6 (9.3.6-elpa @ 
/home/username/.emacs.d/elpa/org-9.3.6/)



current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-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-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 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-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-babel-load-languages '((emacs-lisp . t) (python . t))
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export
org-attach-export-link :complete
org-attach-complete-link)
   ("id" :follow org-id-open)
   ("eww" :follow eww :store org-eww-store-link)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store
org-mhe-store-link)
   ("irc" :follow org-irc-visit :store
org-irc-store-link :export org-irc-export)
   ("info" :follow org-info-open :export
org-info-export :store org-info-store-link)
   ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export
org-bbdb-export :complete org-bbdb-complete-link
:store org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys")
   ("file+emacs")
   ("shell" :follow org-link--open-shell)
   ("news" :follow
#[257 "\301\300\302Q!\207"
  ["news" browse-url ":"] 5 "\n\n(fn URL)"]
)
   ("mailto" :follow
#[257 "\301\300\302Q!\207"
  ["mailto" browse-url ":"] 5 "\n\n(fn URL)"]
)
   ("https" :follow
#[257 "\301\300\302Q!\207"
  ["https" browse-url ":"] 5 "\n\n(fn URL)"]
)
   ("http" :follow

Bug: org-babel python with :results value sends function definition with a statement after a for loop to the shell incorrectly [9.3.6 (9.3.6-elpa @ /home/username/.emacs.d/elpa/org-9.3.6/)]

2020-07-01 Thread Philip Blagoveschensky

Consider the following org-babel block:



#+begin_src python :session bug_report
def foobar():
for i in range(5):
pass
print "hello world"

foobar()
#+end_src



When I run it, this is what I see in the *bug_report* buffer:



def foobar():
... for i in range(5):
... pass
...

print "hello world"

  File "", line 1
print "hello world"
^
IndentationError: unexpected indent


foobar()

open('/tmp/babel-MOOCF9/python-UW5PEF', 'w').write(str(_))


'org_babel_python_eoe'
'org_babel_python_eoe'





So, org-babel incorrectly decided that the line with the print is not a 
part of the function's definition and sent it to Python shell as a 
separate statement. Instead, it should've sent it as a part of foobar's 
definition.


This problem persists
- If I use python3 instead of python2
- If I replace
print "hello world"
  with
return 42

This problem disappears if I add :results output to the source block.


Emacs  : GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-09-23, modified by Debian
Package: Org mode version 9.3.6 (9.3.6-elpa @ 
/home/username/.emacs.d/elpa/org-9.3.6/)



current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-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-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 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-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-babel-load-languages '((emacs-lisp . t) (python . t))
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
  org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export
org-attach-export-link :complete
org-attach-complete-link)
   ("id" :follow org-id-open)
   ("eww" :follow eww :store org-eww-store-link)
   ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store
org-mhe-store-link)
   ("irc" :follow org-irc-visit :store
org-irc-store-link :export org-irc-export)
   ("info" :follow org-info-open :export
org-info-export :store org-info-store-link)
   ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
   ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export
org-bbdb-export :complete org-bbdb-complete-link
:store org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link) ("file+sys")
   ("file+emacs")
   ("shell" :follow org-link--open-shell)
   ("news" :follow
#[257 "\301\300\302Q!\207"
  ["news" browse-url ":"] 5 "\n\n(fn URL)"]
)
   ("mailto" :follow
#[257 "\301\300\302Q!\207"
  ["mailto" browse-url ":"] 5 "\n\n(fn URL)"]
)
   ("https" :follow
#[257 "\301\300\302Q!\207"
  ["https" browse-url ":"] 5 "\n\n(fn URL)"]
)
   ("http" :follow
#[257