[O] refile to only headers in the current subtree?

2016-05-08 Thread Samuel Wales
is it possible to set org-refile-targets so that the targets for
refiling are restricted to the current header's parent and anything
below that?



Re: [O] Bug: check that org-element--cache-sync-keys is non-nil before clrhash [8.3.4 (8.3.4-42-gae73c7-elpa @ /home/mah/.emacs.d/elpa/org-20160425/)]

2016-05-08 Thread Mark A. Hershberger

Nicolas Goaziou writes:

> I'm surprised about this. Cache mechanism in available in Org mode
> buffers only. Not even when using `orgstruct-mode' (see
> 0b97a551704d50ae848c59d00b0d425554891e53).
>
> Could you investigate about how this happens in your case?

I don't know, but I've seen it happen a few times when using "M-x
woman".  Backtrace below.

It looks like a timer or event is being invoked and that is resulting in
the error.

If you have any ideas of what I should look for in my configuration, I
could poke around, but right now I don't know what to even look for.

-- 
Mark A. Hershberger
NicheWork LLC
717-271-1084

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  clrhash(nil)
  (if org-element--cache-sync-requests (org-element--cache-set-timer buffer) 
(clrhash org-element--cache-sync-keys))
  (let ((inhibit-quit t) request next) (if org-element--cache-sync-timer (progn 
(cancel-timer org-element--cache-sync-timer))) (catch (quote interrupt) (while 
org-element--cache-sync-requests (setq request (car 
org-element--cache-sync-requests) next (nth 1 
org-element--cache-sync-requests)) (org-element--cache-process-request request 
(and next (aref next 0)) threshold (and (not threshold) (time-add 
(current-time) org-element-cache-sync-duration)) future-change) (if next (progn 
(let* ((v next)) (aset v 3 (+ ... ...))) (aset next 2 (aref request 2 (setq 
org-element--cache-sync-requests (cdr org-element--cache-sync-requests (if 
org-element--cache-sync-requests (org-element--cache-set-timer buffer) (clrhash 
org-element--cache-sync-keys)))
  (save-current-buffer (set-buffer buffer) (let ((inhibit-quit t) request next) 
(if org-element--cache-sync-timer (progn (cancel-timer 
org-element--cache-sync-timer))) (catch (quote interrupt) (while 
org-element--cache-sync-requests (setq request (car 
org-element--cache-sync-requests) next (nth 1 
org-element--cache-sync-requests)) (org-element--cache-process-request request 
(and next (aref next 0)) threshold (and (not threshold) (time-add 
(current-time) org-element-cache-sync-duration)) future-change) (if next (progn 
(let* (...) (aset v 3 ...)) (aset next 2 (aref request 2 (setq 
org-element--cache-sync-requests (cdr org-element--cache-sync-requests (if 
org-element--cache-sync-requests (org-element--cache-set-timer buffer) (clrhash 
org-element--cache-sync-keys
  (progn (save-current-buffer (set-buffer buffer) (let ((inhibit-quit t) 
request next) (if org-element--cache-sync-timer (progn (cancel-timer 
org-element--cache-sync-timer))) (catch (quote interrupt) (while 
org-element--cache-sync-requests (setq request (car 
org-element--cache-sync-requests) next (nth 1 
org-element--cache-sync-requests)) (org-element--cache-process-request request 
(and next (aref next 0)) threshold (and (not threshold) (time-add ... 
org-element-cache-sync-duration)) future-change) (if next (progn (let* ... ...) 
(aset next 2 ...))) (setq org-element--cache-sync-requests (cdr 
org-element--cache-sync-requests (if org-element--cache-sync-requests 
(org-element--cache-set-timer buffer) (clrhash org-element--cache-sync-keys)
  (if (buffer-live-p buffer) (progn (save-current-buffer (set-buffer buffer) 
(let ((inhibit-quit t) request next) (if org-element--cache-sync-timer (progn 
(cancel-timer org-element--cache-sync-timer))) (catch (quote interrupt) (while 
org-element--cache-sync-requests (setq request (car 
org-element--cache-sync-requests) next (nth 1 
org-element--cache-sync-requests)) (org-element--cache-process-request request 
(and next ...) threshold (and ... ...) future-change) (if next (progn ... ...)) 
(setq org-element--cache-sync-requests (cdr 
org-element--cache-sync-requests (if org-element--cache-sync-requests 
(org-element--cache-set-timer buffer) (clrhash 
org-element--cache-sync-keys))
  org-element--cache-sync(#)
  apply(org-element--cache-sync #)
  byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 0 0 60 nil org-element--cache-sync (#) idle 0])




[O] countdown timer to count up

2016-05-08 Thread Samuel Wales
i use the countdown timer to display a countdown in the mode line and
to indicate when it has reached zero.

can it, at that time, also start a countup timer in the mode line so i
knw how much time it has been sicne it reached zero?

if not, can anybody recommend some timer packages?

thanks.

-- 
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] Question on nested-blocks syntax

2016-05-08 Thread Rasmus
Nicolas Goaziou  writes:

>> Aside: I think a big getting rid of the FORTRAN-70 "touch" (capitalized
>> keywords and delimiters) would make Org must more ascetically pleasing.
>> (We’d just need to change default usage of templates and block
>> capitalization).
>
> I guess we could do that. 
>
> However, I think it is already easy to write every keyword as lower 
> case.

As said, templates, and blocks inserted via org-structure-template-alist
are uppercased (as least the default).

> Moreover, there is no lower case for "#".

Neither is there a uppercase...


-- 
evidence suggests Snowden used a powerful tool called monospaced fonts



Re: [O] [BUG] Noweb reference eval syntax does not work

2016-05-08 Thread Thomas S. Dye
Aloha all,

Rasmus writes:
>
>> What do you, and others, think? Is NAME enough for noweb syntax, or is
>> there a real need fo :noweb-ref?
>
> I've put Aaron in carbon copy as he’s quite familiar with ob.

The motivation for noweb-ref is discussed in this thread from about 5
years ago:
http://thread.gmane.org/gmane.emacs.orgmode/42636/focus=42639

FWIW, I haven't used noweb-ref.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] Mixing Python2 and Python3 blocks in one file

2016-05-08 Thread Karl Voit
* Karl Voit  wrote:
> Hi!
>
> Python2 and Python3 are two different languages. Unfortunately,
> Org-mode only uses ~#+BEGIN_SRC python~ for both and uses
> python-shell-interpreter to choose/switch the compiler.
>
> Shouldn't Org-mode introduce ~#+BEGIN_SRC python2~ and ~#+BEGIN_SRC
> python3~ to solve this issue in a clean way?
>
> ~#+BEGIN_SRC python~ can still default to python2.
>
>
> I only found those sources/solutions:

Correct links:

http://article.gmane.org/gmane.emacs.orgmode/47878
> ... file-variables to choose interpretor

http://article.gmane.org/gmane.emacs.orgmode/47955
> ... workaround with #+srcname (I don't get yet)

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github




[O] org-agenda-bulk-custom-functions Customize mismatch

2016-05-08 Thread Phil Hudson
Another defcustom mismatched with the code.

At line 9962 of org-agenda.el (20160502 release) we have:

  (setq cmd (list (cadr (assoc action org-agenda-bulk-custom-functions)))

This assumes that `org-agenda-bulk-custom-functions` is a
list-of-two-element-lists alist. Thus, the `cadr` form returns (should
return) the second element of one two-element list from the alist.

However, the defcustom is declared as type alist, which in defcustom
means (by default) a list-of-conses alist.

See if you agree with my thinking about this. This means that the code
must always fail if the Customize UI is used to populate
`org-agenda-bulk-custom-functions`. That in turn implies that (to a
first approximation) zero users apart from me have tried to declare a
custom bulk agenda command with its own custom key via Customize. Oh
well.

If my diagnosis is correct, then I see two ways to fix it: either change
the defcustom to create a list-of-two-element-lists alist, or change the
code so that it handles a list-of-conses alist.

The first approach is supported by defcustom and gives us the chance to
be both more descriptive and more prescriptive. It shouldn't break
anything that isn't in fact already broken.

The second approach is as simple as changing that `cadr` to a `cdr`, but
it does risk breaking working configs where the alist was populated
procedurally.

I propose the first. Here's a patch.

-- 
Phil Hudson   http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63


--- org-20160502/org-agenda.el  2016-05-07 10:18:22.0 +0100
+++ org-mode-mod/org-agenda.el  2016-05-08 14:39:52.0 +0100
@@ -1999,7 +1999,7 @@
 With selected entries in an agenda buffer, `B R' will call
 the custom function `set-category' on the selected entries.
 Note that functions in this alist don't need to be quoted."
-  :type 'alist
+  :type '(alist :key-type character :value-type (group function))
   :version "24.1"
   :group 'org-agenda)
 



Re: [O] Question on nested-blocks syntax

2016-05-08 Thread Nicolas Goaziou
Rasmus  writes:

> Nicolas Goaziou  writes:
>
>> I sympathize with aesthetics concerns, Org syntax, particularly blocks,
>> is "massive", but I think this is not a sufficient motivation here.
>
> I wonder what you mean by "massive" here?  Do you mean the fact that there
> is an explicit beginning and end?

I mean that, visually, it can be a bit invasive, at times.

> Aside: I think a big getting rid of the FORTRAN-70 "touch" (capitalized
> keywords and delimiters) would make Org must more ascetically pleasing.
> (We’d just need to change default usage of templates and block
> capitalization).

I guess we could do that. 

However, I think it is already easy to write every keyword as lower
case. Moreover, there is no lower case for "#".


Regards,



Re: [O] [BUG] Noweb reference eval syntax does not work

2016-05-08 Thread Rasmus
Hi,

Nicolas Goaziou  writes:

> fm4d  writes:
>
>> The noweb reference syntax that should insert results of
>> evaluation of src block itself instead of src block as
>> described in `org-babel-expand-noweb-reference` does not
>> seems to work.
>>
>>
>> Code for replication:
>>
>> * Assign 
>>
>> First we assign abc:
>>
>> #+begin_src python :noweb-ref assign_abc
>> abc = "abc" + "def"
>> #+end_src
>>
>> * Use
>>
>> Then we use it in a function:
>>
>> #+begin_src python :noweb tangle :tangle noweb-test.py
>> def x():
>>   <>
>>   return abc
>>
>> print(x())
>> #+end_src
>>
>>
>> <> does work,  fails with this error:
>>
>> (error "Reference ‘assign_abc’ not found in this buffer")
>>   signal(error ("Reference ‘assign_abc’ not found in this buffer"))
>>   error("Reference `%s' not found in this buffer" "assign_abc")
>>   org-babel-ref-resolve("assign_abc()")
>>   ...
>>
>>
>> I am not sure if this is a bug or I am doing something wrong,
>> the documentation on this feature is not very comprehensive.
>
> I just discovered the :noweb-ref parameter.

I have used :noweb yes in the past, but it seems :noweb-ref can be
replaced by name in at least the single blog case:

#+name: data
#+BEGIN_SRC R
  set.seed(42)
  df1 <- data.frame(x=rnorm(10), y=rnorm(10))
#+END_SRC

#+BEGIN_SRC R :noweb yes
<>
colMeans(df1)
#+END_SRC

As you mention, we’d loose the ability to chain together multiple blocks.
I reckon they are meaningfully the same language, so I don’t see a loss.
The example shown in the manual also does not convince me of the
usefullness of this.

> It is redundant with #+NAME: keyword and slightly broken. Also it
> induces hacks like `org-babel-use-quick-and-dirty-noweb-expansion' to
> work-around its shortcomings. 
>
> Besides, it doesn't make much sense to add the same parameters to
> a bunch of blocks, so I find the syntax dubious.
>
> I understand it can be a handy shortcut for inserting multiple blocks,
> but, all in all, I tend to think it would be simpler to just remove the
> feature, along with `:noweb-sep' and
> `org-babel-use-quick-and-dirty-noweb-expansion'.

I’m happy to kill it off in Org-9.  I don’t know how widely the chaining
of blocks is used, though, and whether the fix is always as simple as
uniting the blocks.

> What do you, and others, think? Is NAME enough for noweb syntax, or is
> there a real need fo :noweb-ref?

I've put Aaron in carbon copy as he’s quite familiar with ob.

Rasmus

-- 
Governments should be afraid of their people




Re: [O] how to org-refile to a target within the current file?

2016-05-08 Thread Peter Salazar
Here's the solution:

(defun my-org-files-list ()
  (delq nil
(mapcar (lambda (buffer)
  (buffer-file-name buffer))
  (org-buffer-list 'files t

On Wed, May 4, 2016 at 1:20 PM, Peter Salazar  wrote:

> Hello, I use org-refile quite a bit, but for my use-case, I want to refile
> my org-mode subtrees not to an org-agenda file, but to the current file or
> another file I'm currently visiting.
>
> I had a way of doing this that was working correctly, but now has stopped
> working. I'm not sure what I changed that broke it.
>
> Here's the code I'm using for org-refile:
>
> (setq org-outline-path-complete-in-steps nil) ; Refile in a single go
> (setq org-completion-use-ido nil)
> (setq org-refile-use-outline-path t) ; Show full paths for refiling
> (setq org-refile-allow-creating-parent-nodes (quote confirm)) ; allow
> refile to create parent tasks with confirmation
>
> (defun my-org-files-list ()
>  (mapcar (lambda (buffer)
>(buffer-file-name buffer))
>(org-buffer-list 'files t)))
>
> (setq org-refile-targets '((my-org-files-list :maxlevel . 3)))
>
> Again, this used to work. But now when I run org-refile, I get this:
>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   get-file-buffer(nil)
>   org-find-base-buffer-visiting(nil)
>   org-get-agenda-file-buffer(nil)
>   org-refile-get-targets(nil (#("this" 0 4 (fontified t face
> org-level-1
>   org-refile-get-location("Refile subtree \"this\" to" nil confirm nil)
>   org-refile(nil)
>   call-interactively(org-refile record nil)
>   command-execute(org-refile record)
>   execute-extended-command(nil "org-refile")
>   call-interactively(execute-extended-command nil nil)
>   command-execute(execute-extended-command)
>
> Any suggestions on how to fix this? Thanks!
>
>


Re: [O] [BUG] Noweb reference eval syntax does not work

2016-05-08 Thread Nicolas Goaziou
Hello,

fm4d  writes:

> The noweb reference syntax that should insert results of
> evaluation of src block itself instead of src block as
> described in `org-babel-expand-noweb-reference` does not
> seems to work.
>
>
> Code for replication:
>
> * Assign 
>
> First we assign abc:
>
> #+begin_src python :noweb-ref assign_abc
> abc = "abc" + "def"
> #+end_src
>
> * Use
>
> Then we use it in a function:
>
> #+begin_src python :noweb tangle :tangle noweb-test.py
> def x():
>   <>
>   return abc
>
> print(x())
> #+end_src
>
>
> <> does work,  fails with this error:
>
> (error "Reference ‘assign_abc’ not found in this buffer")
>   signal(error ("Reference ‘assign_abc’ not found in this buffer"))
>   error("Reference `%s' not found in this buffer" "assign_abc")
>   org-babel-ref-resolve("assign_abc()")
>   ...
>
>
> I am not sure if this is a bug or I am doing something wrong,
> the documentation on this feature is not very comprehensive.

I just discovered the :noweb-ref parameter.

It is redundant with #+NAME: keyword and slightly broken. Also it
induces hacks like `org-babel-use-quick-and-dirty-noweb-expansion' to
work-around its shortcomings. 

Besides, it doesn't make much sense to add the same parameters to
a bunch of blocks, so I find the syntax dubious.

I understand it can be a handy shortcut for inserting multiple blocks,
but, all in all, I tend to think it would be simpler to just remove the
feature, along with `:noweb-sep' and
`org-babel-use-quick-and-dirty-noweb-expansion'.

What do you, and others, think? Is NAME enough for noweb syntax, or is
there a real need fo :noweb-ref?


Regards,

-- 
Nicolas Goaziou



[O] Mixing Python2 and Python3 blocks in one file

2016-05-08 Thread Karl Voit
Hi!

Python2 and Python3 are two different languages. Unfortunately,
Org-mode only uses ~#+BEGIN_SRC python~ for both and uses
python-shell-interpreter to choose/switch the compiler.

Shouldn't Org-mode introduce ~#+BEGIN_SRC python2~ and ~#+BEGIN_SRC
python3~ to solve this issue in a clean way?

~#+BEGIN_SRC python~ can still default to python2.


I only found those sources/solutions:

http://thread.gmane.org/gmane.emacs.orgmode/47867
... file-variables to choose interpretor

http://thread.gmane.org/gmane.emacs.orgmode/47867
... workaround with #+srcname (I don't get yet)


-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github