Re: [O] Babel problem: Output incomplete if it contains # character (only in session)

2018-06-12 Thread Narendra Joshi
Marian Schubert  writes:

> Hello,
>
> I'm having trouble with babel block like this:
>
> #+BEGIN_SRC shell :results output :session xyz
> echo "foo#bar"
> #+END_SRC
>
> #+RESULTS:
> : 
> : bar
>
> I expect results to be foo#bar, but it's just bar.
> If I remove :session xyz it displays correct value, i.e.:
I also face issues when there is a session involved with shell.
Why don't you try:
export PS1=$
at the beginning of the session as the first command and see if this
fixes it for you?
> #+RESULTS:
> : foo#bar
>
> Any idea what might be wrong?
>
> Best regards,
> Marian
>

-- 
Narendra Joshi



[O] Org-babel bash session with non-standard prompt

2018-06-08 Thread Narendra Joshi
Hi,

If the value for PS1 variable is set to something that doesn't end with
a `$` or `#`, org-babel hangs while using a fixed :session.

To overcome this, I can do the following at the start of a sh org-babel
session: 

#+begin_src bash :session s :results verbatim drawer
export PS1='$ '
ls -lah
#+end_src

And this works ^.

I would like to know if I can somehow pass the environment variable
to the shell that org-babel starts for the session. I don't want to add
it to a snippet and do not want to type it every time. 

Any help would be greatly appreciated. 

Thanks,
-- 
Narendra Joshi



Re: [O] show future scheduled date in Agenda

2018-01-28 Thread Narendra Joshi
Ken Mankoff <mank...@gmail.com> writes:

> I have a custom agenda with a section that is generated with:
>
> (todo "WAITING|VERIFY" ((org-agenda-overriding-header "Waiting or Verify")))
You will need to do (agenda "WAITING|VERIFY" ...) for items that are
scheduled. They will be displayed only if you have adjusted value for
`org-scheduled-delay-days`. 

> And it generates an Agenda section that looks like:
>
> ==
> Waiting or Verify
>  Foo: WAITING Something
>  Bar: WAITING Other Thing:tag:
>  Bar: VERIFY  Did X happen?
>
> Is it possible to show SCHEDULED dates for these items? I often set something 
> to WAITING and re-schedule it for +7d, but would like to know at a glance 
> when something is scheduled (if it is). The new Agenda section might look 
> like:
>
> ==
> Waiting or Verify
>  Foo: WAITING [2018-06-10 Sun] Something
>  Bar: WAITING [2018-09-22 Sat] Other Thing:tag:
>  Bar: VERIFY  Did X happen?
I think you can adjust the format of this with some
variable. `org-agenda-prefix-format` has a specifier "%s" for scheduling
information. There must be a variable/function for formatting scheduling
information. I couldn't quickly find it though.

> Or
>
> ==
> Waiting or Verify
>  Foo: WAITING [42d]  Something
>  Bar: WAITING [212d] Other Thing:tag:
>  Bar: VERIFY     Did X happen?
This should be available with the default prefix format for agenda type
entries in your custom agenda.

Best,
-- 
Narendra Joshi



Re: [O] Searching all attachments in org-files

2017-12-26 Thread Narendra Joshi
Ihor Radchenko <yanta...@gmail.com> writes:

> Dear Narendra,
>
> Here is what I am using:
>
> (defun org-att-complete-link ( arg)
>   "Completion dispatcher for att: links (rewritten from org-attach-open)"
>   (let* ((attach-dir (org-attach-dir t))
>(files (org-attach-file-list attach-dir))
>(file (if (= (length files) 1)
>  (car files)
>(completing-read "att: "
> (mapcar #'list files) nil t)))
>(path (expand-file-name file attach-dir)))
> (concat "att:" file)))
> (add-to-list 'org-link-abbrev-alist '("att" . org-attach-expand-link))
> (org-link-set-parameters
>  "att"
>  :complete 'org-att-complete-link)
#+begin_src emacs-lisp
(defun org-att-complete-link ( arg)
"Completion dispatcher for att: links (rewritten from org-attach-open)"
(let* ((attach-dir (expand-file-name org-attach-directory org-directory))
   (file-paths (directory-files-recursively attach-dir ".*"))
   (completions (mapcar (lambda (f)
  (cons (file-name-base f) f))
file-paths))
   (file-name (completing-read "att: " completions nil t))
   (path (assoc-default file-name completions)))
  (concat "att:" path)))
#+end_src

This worked for me. I had to change it a bit for my use case. Thanks a
lot for the help! :)

--
Narendra Joshi



[O] Searching all attachments in org-files

2017-12-25 Thread Narendra Joshi
Hi,

Is there a way to quick get a link to an existing attachment? A lot of
times, I find myself referring to the same file. I like to keep files as
attachments so that they are committed with my org-files. Any help here,
either in fixing my workflow or helping me figure out how to get a link
to an existing file that is attached to an org-heading, would be greatly
appreciated.

Thanks,
-- 
Narendra Joshi



Re: [O] ox-publish export subtree scopes?

2017-12-09 Thread Narendra Joshi
Kaushal Modi <kaushal.m...@gmail.com> writes:

> On Tue, Dec 5, 2017 at 7:31 AM Rasmus <ras...@gmx.us> wrote:
>
> If you have any suggestions on how to improve ox-publish to
> better suit
> please share them.
>
>
> Hello Rasmus,
>
> I'd like to make the ox-publish based exporting working for my
> ox-hugo[1] package but so far have been unsuccessful.
>
> The main reason is that org-foo-publish-to-bar functions take only
> plist, filename and pub-dir as args. I miss the ability to first pick
> a subtree scope from the specific Org file and then export only that.
> Is something like that already possible which I am missing?
>
> In addition, when given a file name, I need to auto-decide (i) if I
> need to cycle through "valid" subtrees (see more about that below)
> and export those subtrees,or (ii) export the whole Org file if #
> +TITLE is present.
>
> So I ended up with org-hugo-export-wim-to-md[2] ("wim" stands for
> What I Mean). Below is a snippet from its doc string:
>
> =
> - If the current subtree has the \"EXPORT_FILE_NAME\" property,
> export
>   that subtree.
> - If the current subtree doesn't have that property, but one of its
>   parent subtrees has, then export from that subtree's scope.
> - If none of the subtrees have that property (or if there are no Org
>   subtrees at all), but the Org #+TITLE keyword is present,
>   export the whole Org file as a post with that title (calls
>   `org-hugo-export-to-md' with its SUBTREEP argument set to nil).
>
> - If ALL-SUBTREES is non-nil, export all valid Hugo post subtrees
>   \(that have the \"EXPORT_FILE_NAME\" property) in the current file
>   to multiple Markdown posts.
> - If ALL-SUBTREES is non-nil, and again if none of the subtrees have
>   that property (or if there are no Org subtrees), but the Org #
> +TITLE
>   keyword is present, export the whole Org file.
>
> - If the file neither has valid Hugo post subtrees, nor has the
>   #+TITLE present, throw a user error.  If NOERROR is non-nil, use
>   `message' to display the error message instead of signaling a user
>   error.
> =
>
> And I use a Makefile[3] to find all Org files in the current directly
> and call the above function, which then does the right thing as
> explained in the conditions above.
>
> Is there any way to call org-publish to export either the entire file
> or cycle through the file and export the subtrees matching a
> predicate?
>
> [1]: https://github.com/kaushalmodi/ox-hugo
> [2]: https://github.com/kaushalmodi/ox-hugo/blob/
> 832a5d7424013f60b77354ec28613440afac0269/ox-hugo.el#L2424-L2448
> [3]: https://github.com/kaushalmodi/ox-hugo/blob/master/Makefile
> --
>
> Kaushal Modi

I have faced something similar (or maybe not very similar) while using
`org-publish' for my static blog. I wanted to wrap everything inside
body in a container and a row (bootstrap classes). The functions
provided do not let me do this conveniently. I can define `content',
`preamble' and `postamble' but cannot wrap all three of them inside a
`div' without overriding the whole export function.

Best,
-- 
Narendra Joshi



[O] org-store-link not working on a Gnus heading

2017-11-04 Thread Narendra Joshi
Hello,

I get an error
`org-gnus-store-link: Invalid function: gnus-summary-article-header`
when trying to get a link to an article in Gnus. Is this a known bug?

Best,
Narendra





-- 
Narendra Joshi



Re: [O] Dynamic Org-capture Templates

2017-11-04 Thread Narendra Joshi
Eric Thomas <e...@ericthomas.net> writes:

> Does anyone know how to approach creating dynamic Org-capture
> templates? I'm looking for IDO/Helm type of completion after a
> template has been selected. If string does not exist, it is created
> and added to future completions, similar to new files in emacs.
>
> Example:
>
> C-c c
> "a" (activity)
> Activity: math   (<--need completion here)
> Topic: multiplication   (<--need completion here)
> Date: 2017-09-11   (<--need default to todays date)
> Start time: 07:00 AM  (<--need to define AM/PM easily)
> Duration: 20   (<--easier way to capture time?)
> Unit: mins
>
> And
>
> C-c c
> "a" (activity)
> Activity: physical education (<--again, completion starts as "ph.." is typed)
> Type: Yoga (<--completion)
> Class: Level 2 flow  (<--completion)
> Date: 2017-09-11 (<--date picker of some kind)
> Start time: 07:00 AM   (<--define AM/PM easily)
> Duration: 90(<--easy method for capturing time)
> Unit: mins
>
>
> Maybe Org-capture templates are not the correct way to approach this?
> Any direction is appreciated.
>From doc string for `org-capture-templates`:
  %^{prompt}  Prompt the user for a string and replace this sequence with it.
  A default value and a completion table ca be specified like this:
  %^{prompt|default|completion2|completion3|...}.

I think to get completion you would need to dynamically build the value
for `org-capture-templates` which would include the completion
candidates for reach field. I think that's not a great way to do
it. Someone else can suggest a better way, I think. 

-- 
Narendra Joshi



Re: [O] Agenda filtering (take 2)

2017-10-04 Thread Narendra Joshi
Richard Lawrence <richard.lawre...@berkeley.edu> writes:

> Hi everyone,
>
> About a year ago, I wrote: 
>>
>>> Is there a simple way for me to say to the agenda, "Show me all (and only)
>>> the NEXT tasks that are part of a project whose deadline is before (say)
>>> 2016-11-01"?  It seems like this should be possible with the built-in agenda
>>> but I can't quite figure it out.  The tricky thing is filtering by the
>>> deadline of the parent project, which might be several levels up. 
>
> I'm still stuck on this, so I'd like to ask this question again. Bastien
> responded: 
>
>> I would add a category to each project, then use something along this: 
>>
>> ("N" "My important tasks" tags-todo
>> "CATEGORY={cat1\\|cat2}+TODO={NEXT}+DEADLINE<=\"<+3d>\"") 
>
> But that doesn't seem to work for me.  The problem is that the tasks I want to
> list in the tags-todo search don't themselves have deadlines; only their 
> parent
> projects do.
>
> I have a file with projects that look like this:
>
> ** TODO Foo University DEADLINE: <2017-11-01>
> *** NEXT Determine application requirements for Foo U.
> *** TODO Submit application
>
> I'd like to see a list of just NEXT tasks in this file, sorted by the deadline
> of their parent projects.
>
> I thought that property inheritance would be the way to do this. So I tried: 
>
>("jn" "Job application NEXT tasks" tags-todo
> "+jobmarket+application+TODO={NEXT}"   ((org-use-property-inheritance t))
> (org-agenda-sorting-strategy '(deadline-up 
>
> as well as
>
>("jn" "Job application NEXT tasks" tags-todo
> "+jobmarket+application+TODO={NEXT}"   ((org-use-property-inheritance
> '("DEADLINE"))(org-agenda-sorting-strategy '(deadline-up 
>
> in org-agenda-custom-commands.  But neither seems to work.  Can anyone provide
> any insights here?  Is it possible for sub-tasks within a project to inherit
> their deadline? 
Found an already asked question that might help:
https://lists.gnu.org/archive/html/emacs-orgmode/2016-04/msg00373.html
You can set org-agenda-sorting-strategy to `user-defined-up' and use the
function used in the thread I have posted above to compare two NEXT entries.

> Many thanks as always!
>
> Best,
> Richard
>

-- 
Narendra Joshi



Re: [O] Auto-filling in org-mode without affecting the headlines

2017-09-10 Thread Narendra Joshi
I tried with emacs -Q and was able to reproduce the problem.

```
(~) λ emacs-version
GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2017-08-07
(~) λ org-version
9.0.9
(~) λ
```

On Mon, Sep 11, 2017 at 1:22 AM, Richard Lawrence
<richard.lawre...@berkeley.edu> wrote:
> Hi Narendra,
>
> Narendra Joshi <narendr...@gmail.com> writes:
>
>> I would like to have auto-fill enabled in org-mode but would like to
>> prevent headings from being auto-filled. Is something available in org-mode
>> that would allow me to do this?
>
>
> I have used auto-fill-mode in Org buffers for quite a while now without any
> problems, and a quick test on my end shows that long headings don't get
> auto-filled.  Are you having problems with this?  If so, what version of Org
> and Emacs are you using?   -- Best,
> Richard



[O] Auto-filling in org-mode without affecting the headlines

2017-09-10 Thread Narendra Joshi
Hi,

I would like to have auto-fill enabled in org-mode but would like to
prevent headings from being auto-filled. Is something available in
org-mode that would allow me to do this?

Thanks,
--
Narendra Joshi



[O] Change todo state when scheduled or a deadline is set

2017-08-30 Thread Narendra Joshi
Hi,

I would like to change the state of a task to TODO when it is scheduled
or a deadline is set for the task. I couldn't find any hook that is
called after scheduling. How can I do this? 

Best,
-- 
Narendra Joshi



[O] How do you organize a project and its related sub-tasks

2017-06-18 Thread Narendra Joshi
Hi,

I am curious about how people organize a project and its sub-tasks. For
example, say building a website. Do you make the task a TODO task and
then have TODO tasks under it? I don't like that the project appears in
my org-agenda as a separate thing along with its sub-tasks. How do you
handle this? 

Best,
-- 
Narendra Joshi



[O] Grouping tasks with todo-keywords

2017-06-17 Thread Narendra Joshi
Hi,

Is it possible to group tasks in org-agenda by the state they are in? 
For example, I would like to have horizontal divider between all tasks
that are ONGOING and tasks that are in TODO state. 
I have already setup `org-agenda-sorting-strategy' to get the desired
order.

Best,
-- 
Narendra Joshi



Re: [O] How to stop org delete surrounding newline when adding headlines?

2017-03-10 Thread Narendra Joshi
ot;%s" (if ... "" ... dotime nil mouse-face highlight 
org-not-done-regexp "\\(TODO\\|TRACKING\\)" org-todo-regexp 
"\\(TODO\\|DONE\\|WONT-DO\\|TRACKING\\|TRACKED\\)" org-complex-heading-regexp 
"^\\(\\*+\\)\\(?: +\\(TODO\\|DONE\\|WONT-DO\\|TRACKING\\|TRACKED\\)\\)?\\(?: 
+\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[  
]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[]*$" help-echo "mouse-2 or RET jump to 
org file ~/miscellany/personal/org/main.org" org-marker # warntime nil ts-date 736399 org-hd-marker # priority 999 ...) 26 56 (org-heading t org-category "main" fontified 
nil tags ("workout") org-highest-priority 65 org-lowest-priority 67 time-of-day 
nil duration nil effort "" effort-minutes nil breadcrumbs nil txt #("TODO 
Workout on alternate days  :workout:" 0 30 (fontified nil org-category 
"main" org-heading t) 30 49 (org-heading t)) level "  " time "" extra "In   1 
d.: " format (((org-prefix-has-time t) (org-prefix-has-tag nil) 
(org-prefix-category-length 12) (org-prefix-has-effort nil) 
(org-prefix-has-breadcrumbs nil)) (format " %s %s%s%s" (format "%s" (if ... "" 
...)) (format "%-12s" (if ... "" ...)) (if (equal "" time) "" (format "%-12s" 
...)) (format "%s" (if ... "" ... dotime nil mouse-face highlight 
org-not-done-regexp "\\(TODO\\|TRACKING\\)" org-todo-regexp 
"\\(TODO\\|DONE\\|WONT-DO\\|TRACKING\\|TRACKED\\)" org-complex-heading-regexp 
"^\\(\\*+\\)\\(?: +\\(TODO\\|DONE\\|WONT-DO\\|TRACKING\\|TRACKED\\)\\)?\\(?: 
+\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ 
]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[]*$" help-echo "mouse-2 or RET jump to 
org file ~/miscellany/personal/org/main.org" org-marker # warntime nil ts-date 736399 ...) 56 75 (org-heading t org-category 
"main" tags ("workout") org-highest-priority 65 org-lowest-priority 67 
time-of-day nil duration nil effort "" effort-minutes nil breadcrumbs nil txt 
#("TODO Workout on alternate days  :workout:" 0 30 (fontified nil 
org-category "main" org-heading t) 30 49 (org-heading t)) level "  " time "" 
extra "In   1 d.: " format (((org-prefix-has-time t) (org-prefix-has-tag nil) 
(org-prefix-category-length 12) (org-prefix-has-effort nil) 
(org-prefix-has-breadcrumbs nil)) (format " %s %s%s%s" (format "%s" (if ... "" 
...)) (format "%-12s" (if ... "" ...)) (if (equal "" time) "" (format "%-12s" 
...)) (format "%s" (if ... "" ... dotime nil mouse-face highlight 
org-not-done-regexp "\\(TODO\\|TRACKING\\)" org-todo-regexp 
"\\(TODO\\|DONE\\|WONT-DO\\|TRACKING\\|TRACKED\\)" org-complex-heading-regexp 
"^\\(\\*+\\)\\(?: +\\(TODO\\|DONE\\|WONT-DO\\|TRACKING\\|TRACKED\\)\\)?\\(?: 
+\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ 
]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[]*$" help-echo "mouse-2 or RET jump to 
org file ~/miscellany/personal/org/main.org" org-marker # warntime nil ts-date 736399 org-hd-marker # ...
  org-agenda-get-day-entries("/home/nj/miscellany/personal/org/main.org" (3 10 
2017) :deadline :scheduled :timestamp :sexp)
  apply(org-agenda-get-day-entries "/home/nj/miscellany/personal/org/main.org" 
(3 10 2017) (:deadline :scheduled :timestamp :sexp))
  org-agenda-list(nil)
  funcall-interactively(org-agenda-list nil)
  call-interactively(org-agenda-list nil nil)
  #[1025 "\306.\211?\205.  \211.\306.\n\203.\307 
\210.9\203(.\310N\203(.\203(.\311\303!\202\244.\312.!\262.\211\211\242\313=\262.\203C.\314.\"\211\262.\204).\315.!\203s.\203l.\316.E\fB.
\247\203l.
\317V\203l.
\f\233\211:\203k.\211\306\241\210\210\316.\"\202\242.\320...#.9\203\242..\321N\203\242..\322N\204\242.\323.\322\324#\210\325\326\327.
   \211\321N\330#\"\210\262.\207" [debug-on-next-call prefix-arg 
current-prefix-arg disabled-command-function command-history history-length nil 
prefix-command-update disabled run-hooks indirect-function autoload 
autoload-do-load arrayp execute-kbd-macro 0 call-interactively 
byte-obsolete-info command-execute-obsolete-warned put t message "%s" 
macroexp--obsolete-warning "command"] 13 2406715](org-agenda-list nil nil nil)
  ad-Advice-command-execute(#[1025 "\306.\211?\205.\211.\306.\n\203.\307 
\210.9\203(.\310N\203(.\203(.\311\303!\202\244.\312.!\262.\211\211\242\313=\262.\203C.\314.\"\211\262.\204).\315.!\203s.\203l.\316.E\fB.
\247\203l.
\317V\203l.
\f\233\211:\203k.\211\306\241\210\210\316.\"\202\242.\320...#.9\203\242..\321N\203\242..\322N\204\242.\323.\322\324#\210\325\326\327.
   \211\321N\330#\"\210\262.\207" [debug-on-next-call prefix-arg 
current-prefix-arg disabled-command-function command-history history-length nil 
prefix-command-update disabled run-hooks indirect-function autoload 
autoload-do-load arrayp execute-kbd-macro 0 call-interactively 
byte-obsolete-info command-execute-obsolete-warned put t message "%s" 
macroexp--obsolete-warning "command"] 13 2406715] org-agenda-list)
  apply(ad-Advice-command-execute #[1025 "\306.\211?\205.  
\211.\306.\n\203.\307 
\210.9\203(.\310N\203(.\203(.\311\303!\202\244.\312.!\262.\211\211\242\313=\262.\203C.\314.\"\211\262.\204).\315.!\203s.\203l.\316.E\fB.
\247\203l.
\317V\203l.
\f\233\211:\203k.\211\306\241\210\210\316.\"\202\242.\320...#.9\203\242..\321N\203\242..\322N\204\242.\323.\322\324#\210\325\326\327.
   \211\321N\330#\"\210\262.\207" [debug-on-next-call prefix-arg 
current-prefix-arg disabled-command-function command-history history-length nil 
prefix-command-update disabled run-hooks indirect-function autoload 
autoload-do-load arrayp execute-kbd-macro 0 call-interactively 
byte-obsolete-info command-execute-obsolete-warned put t message "%s" 
macroexp--obsolete-warning "command"] 13 2406715] org-agenda-list)
  command-execute(org-agenda-list)


-- 
Narendra Joshi



Re: [O] Saving org-capture buffer while writing it

2017-02-20 Thread Narendra Joshi
Myles English <mylesengl...@gmail.com> writes:

> Hello,
>
> on [2017-02-20] at 14:05 Narendra Joshi writes:
>
>> Hi,
>>
>> Sometimes when I am taking notes, I end up spending a lot of time in a
>> capture buffer. If I happen to switch to something else, I end up
>> loosing the capture buffer. I probably just kill the buffer
>> accidentally, or do `C-c C-k'.
>>
>> Is there a way I can take backups of the buffer to a file?

> I usually just save it (C-c s) and it is saved to where it would be
> saved anyway when I eventually do C-c C-c.
I just noticed that saving with `C-x C-s` does save the buffer. Why do
you have a personal binding for saving the buffer? Is it doing something
else?

-- 
Narendra Joshi



Re: [O] Saving org-capture buffer while writing it

2017-02-20 Thread Narendra Joshi
Stig Brautaset <s...@brautaset.org> writes:

> Narendra Joshi <narendr...@gmail.com> writes:
>
>> Hi,
>>
>> Sometimes when I am taking notes, I end up spending a lot of time in a
>> capture buffer. If I happen to switch to something else, I end up
>> loosing the capture buffer. I probably just kill the buffer
>> accidentally, or do `C-c C-k'.
>>
>> Is there a way I can take backups of the buffer to a file?
>
> Dunno about backups, but I experience this problem too. (Another
> annoyance I have is accidentally hitting `C-c C-c' to tick a check box
> and having my in-progress work being moved.) It can help to use the
> `:immediate-finish' and `:jump-to-captured' settings like so:
>
> #+BEGIN_SRC emacs-lisp
>   ("n" "Note" entry (file "Notes.org")
>(file "tpl-note.org")
>:empty-lines 1
>:immediate-finish t
>:jump-to-captured t)
> #+END_SRC
>
> Stig
>
> --
> ; GNU Emacs 25.1.1, Org mode version 9.0.5

Do you write your email with Org-mode? I have seen a lot of people
writing the source code blocks and surprising they are syntax
highlighted in Gnus. This makes me wonder if `org-mode' has support for
writing emails too.

Thanks for the info about new keywords. :)

-- 
Narendra Joshi



[O] Saving org-capture buffer while writing it

2017-02-20 Thread Narendra Joshi

Hi,

Sometimes when I am taking notes, I end up spending a lot of time in a
capture buffer. If I happen to switch to something else, I end up
loosing the capture buffer. I probably just kill the buffer
accidentally, or do `C-c C-k'.

Is there a way I can take backups of the buffer to a file?

Thanks,
Narendra Joshi