Re: [O] org-babel: insert named source block

2017-11-15 Thread Berry, Charles

> On Nov 15, 2017, at 4:12 PM, Deepak Cherian  wrote:
> 
> Thanks. That works well, but only shows named source blocks in the particular 
> file.
> 
> Is there a way to make it show library of babel blocks too?

Sure. `org-babel-library-of-babel' is an association list whose keys are the 
names.  Add those to the collection arg of `completing-read'.

Chuck


Re: [O] org-babel: insert named source block

2017-11-15 Thread Deepak Cherian
Thanks. That works well, but only shows named source blocks in the 
particular file.


Is there a way to make it show library of babel blocks too?

Deepak

On 11/15/2017 02:56 PM, Berry, Charles wrote:

On Nov 15, 2017, at 11:04 AM, Deepak Cherian  wrote:

Has anyone here managed to configure ivy or helm to show a list of named source 
blocks that org knows about?

I am imagining this workflow:
1. M-x org-babel-insert-named-source-block (imaginary function)
2. List of named source blocks pops up
3. Hit enter and "#+call: name-of-source-block()" is inserted at point.


org has its own function for listing  named src-blocks.

#+BEGIN_SRC emacs-lisp
   (defun my-insert-named-src-block
   ( &optional template )
 (interactive)
 (let ((template (or template "#+call: %s()\n"))
  (src-block
   (completing-read "Enter src block name[or TAB or ENTER]: " 
(org-babel-src-block-names
   (unless (string-equal "" src-block)
(insert (format template src-block)
#+END_SRC

M-x my-insert-named-src-block TAB 

HTH,

Chuck





[O] Bug: linum-mode + org-indent-mode cursor movement problems [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.2/lisp/org/)]

2017-11-15 Thread Tom Schutter
If both linum-mode (or nlinum-mode) and org-indent-mode are enabled, 
then moving the cursor to the previous line using  causes it to jump 
horizontally to the right.  The jump matches the current indentation.  I 
would expect the cursor to remain in the same column.


Load linum.org (contents below) with minimal config.  linum.org will 
enable linum-mode and org-indent-mode:


  emacs -Q linum.org

Place your cursor on the "2" in the fourth line and press .  The 
cursor will jump two columns to the right to the "4" in the third line. 
Press  again and the cursor will move to the "4" in the second line. 
 Press  again and the cursor will jump back to the "e" in the first 
line.


What is interesting is that you get different behavior when using 
.  The cursor remains in the same column as you move down each 
line.  So starting on the "e" in the first line, pressing  moves 
the cursor to the "2" on the second line.


If you insert a second level heading in between the first and the second 
line, then the jumps will be four columns instead of two.


I discovered this problem first in nlimum-mode, but it is easier to 
reproduce using linum-mode when starting Emacs with -Q.


Contents of linum.org:

  * heading
  1234 line 2
  1234 line 3
  1234 line 4
  # Local Variables:
  # eval: (org-indent-mode 1)
  # eval: (linum-mode 1)
  # End:


Emacs  : GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-09-22, modified by Debian
Package: Org-mode version 8.2.10 (release_8.2.10 @ 
/usr/share/emacs/25.2/lisp/org/)


current state:
==
(setq
 org-tab-first-hook '(org-hide-block-toggle-maybe
  org-src-native-tab-command-maybe
  org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
   [org-add-hook change-major-mode-hook org-show-block-all
append local]
   5]
 #[nil "\300\301\302\303\304$\207"
   [org-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-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
  org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
  org-cycle-hide-inline-tasks org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )



Re: [O] Table refuses to forget cell formula which once overrode a column formula

2017-11-15 Thread Ruy Exel
Thanks for your reply.  I now understand and I also agree it is a good
solution.

Best,
Ruy

On Nov 15, 2017 19:54, "Nicolas Goaziou"  wrote:

> Ruy Exel  writes:
>
> > Thanks very much.  Just out of curiosity I'd be interested in
> understanding
> > how did you do it.  My (non expert) impression is that using properties
> to
> > override column formulas isn't a good idea.
>
> The property is here to prevent evaluation of a column formula on
> a given field. It doesn't override anything.
>
> > It seems to me it would be more natural to apply cell formulas AFTER
> > all column formulas were applied, so that each cell would be simply
> > the output of the formula defining it.
>
> This is what happens already. The property prevents useless
> computations.
>
> Regards,
>


Re: [O] org-babel: insert named source block

2017-11-15 Thread Berry, Charles

> On Nov 15, 2017, at 11:04 AM, Deepak Cherian  wrote:
> 
> Has anyone here managed to configure ivy or helm to show a list of named 
> source blocks that org knows about?
> 
> I am imagining this workflow:
> 1. M-x org-babel-insert-named-source-block (imaginary function)
> 2. List of named source blocks pops up
> 3. Hit enter and "#+call: name-of-source-block()" is inserted at point.
> 

org has its own function for listing  named src-blocks.

#+BEGIN_SRC emacs-lisp
  (defun my-insert-named-src-block
  ( &optional template )
(interactive)
(let ((template (or template "#+call: %s()\n"))
  (src-block
   (completing-read "Enter src block name[or TAB or ENTER]: " 
(org-babel-src-block-names
  (unless (string-equal "" src-block)
(insert (format template src-block)
#+END_SRC

M-x my-insert-named-src-block TAB 

HTH,

Chuck


Re: [O] Table refuses to forget cell formula which once overrode a column formula

2017-11-15 Thread Nicolas Goaziou
Ruy Exel  writes:

> Thanks very much.  Just out of curiosity I'd be interested in understanding
> how did you do it.  My (non expert) impression is that using properties to
> override column formulas isn't a good idea.

The property is here to prevent evaluation of a column formula on
a given field. It doesn't override anything.

> It seems to me it would be more natural to apply cell formulas AFTER
> all column formulas were applied, so that each cell would be simply
> the output of the formula defining it.

This is what happens already. The property prevents useless
computations.

Regards,



Re: [O] How to use case sensitive org-search-view?

2017-11-15 Thread Tim Cross

Yes, that seems like a reasonable and consistent approach to me and most
likely to keep consistency across org-* and core emacs search functions.

regards,

Tim



Nicolas Goaziou  writes:

> Hello,
>
> Tim Cross  writes:
>
>> my 2 cents would vote for a variable which manages case folding. This
>> would be in-line with how isearch works and something familiar to most
>> Emacs users. I also prefer a single function which behaves differently
>> depending on a config variable setting over separate functions as I
>> think it makes key binding easier (though admittedly, it is trivial to
>> define a lambda which selects between different functions depending on
>> the setting of a config variable or prefix arg etc ).
>
> Thinking about it, we may simply drop `org-occur-case-fold-search' and
> use `search-upper-case' wherever that makes sense.
>
> So far, "wherever that makes sense" includes:
> - `org-occur'
> - `org-search-view'
> - what else?
>
> WDYT?
>
> Regards,


-- 
Tim Cross



Re: [O] Table refuses to forget cell formula which once overrode a column formula

2017-11-15 Thread Nick Dokos
Ruy Exel  writes:

> Hi Nicolas,
>
> Thanks very much.  Just out of curiosity I'd be interested in understanding 
> how did you do it.  My (non
> expert) impression is that using properties to override column formulas isn't 
> a good idea.  It seems to
> me it would be more natural to apply cell formulas AFTER all column formulas 
> were applied, so that each
> cell would be simply the output of the formula defining it.
>

Here's what I do in such cases (I'm assuming that the change exists in master, 
either because it
was applied there in the first place, or after a merge with maint):

- update my git repo: git checkout master; git remote update; git rebase
- check recent history: git log -20 --oneline
- find the commit of interest - in this case

   6059c3a05 org-table: Clean left-over `:org-untouchable' property

- show the commit: git show 6059c3a05

HTH.

>
> On Nov 15, 2017 14:42, "Nicolas Goaziou"  wrote:
>
> Hello,
>
> Ruy Exel  writes:
>
> > The following is very simple org-mode spreadsheet in which the cells in 
> the
> > second column show the triple of the corresponding cell in the first 
> column
> > due to the "column formula" in its TBLFM row $2=3*$1;N. However the 
> third
> > row (actually row @4) is an exception because of the "cell formula"
> > @4$2=string("Exception") which expectedly overrides the above column
> > formula.
> >
> > |+---|
> > | Number |    Triple |
> > |+---|
> > |      1 |         3 |
> > |      2 |         6 |
> > |      3 | Exception |
> > |      4 |        12 |
> > |+---|
> >
> > #+TBLFM: $2=3*$1::@4$2=string("Exception")
> >
> > So all is well. Below you will find a copy of the above table, except 
> that,
> > after copying, I have deleted the exceptional formula affecting cell 
> @4$2.
> >
> > |+---|
> > | Number |    Triple |
> > |+---|
> > |      1 |         3 |
> > |      2 |         6 |
> > |      3 | Exception |
> > |      4 |        12 |
> > |+---|
> >
> > #+TBLFM: $2=3*$1
> >
> > One would expect that, after updating this table with C-u C-c *, or C-c 
> C-c
> > in the TBLFM line, the exceptional value in cell @4$2 would revert to 
> the
> > triple of '3', but instead the string "Exception" stays put.
>
> Fixed. Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>

-- 
Nick




Re: [O] Table refuses to forget cell formula which once overrode a column formula

2017-11-15 Thread Ruy Exel
Hi Nicolas,

Thanks very much.  Just out of curiosity I'd be interested in understanding
how did you do it.  My (non expert) impression is that using properties to
override column formulas isn't a good idea.  It seems to me it would be
more natural to apply cell formulas AFTER all column formulas were applied,
so that each cell would be simply the output of the formula defining it.

Best,
Ruy

On Nov 15, 2017 14:42, "Nicolas Goaziou"  wrote:

Hello,

Ruy Exel  writes:

> The following is very simple org-mode spreadsheet in which the cells in
the
> second column show the triple of the corresponding cell in the first
column
> due to the "column formula" in its TBLFM row $2=3*$1;N. However the third
> row (actually row @4) is an exception because of the "cell formula"
> @4$2=string("Exception") which expectedly overrides the above column
> formula.
>
> |+---|
> | Number |Triple |
> |+---|
> |  1 | 3 |
> |  2 | 6 |
> |  3 | Exception |
> |  4 |12 |
> |+---|
>
> #+TBLFM: $2=3*$1::@4$2=string("Exception")
>
> So all is well. Below you will find a copy of the above table, except
that,
> after copying, I have deleted the exceptional formula affecting cell @4$2.
>
> |+---|
> | Number |Triple |
> |+---|
> |  1 | 3 |
> |  2 | 6 |
> |  3 | Exception |
> |  4 |12 |
> |+---|
>
> #+TBLFM: $2=3*$1
>
> One would expect that, after updating this table with C-u C-c *, or C-c
C-c
> in the TBLFM line, the exceptional value in cell @4$2 would revert to the
> triple of '3', but instead the string "Exception" stays put.

Fixed. Thank you.

Regards,

--
Nicolas Goaziou


Re: [O] org-mode gets confused with column widths when 'time-stamp-custom-formats' are applied.

2017-11-15 Thread Ruy Exel
Wow!  That was quick.  Thanks.

Ruy

On Nov 15, 2017 15:15, "Nicolas Goaziou"  wrote:

> Hello,
>
> Ruy Exel  writes:
>
> > Consider the table below:
> >
> > | Name  | Date of Birth|
> > |---+--|
> > | John  | <1978-11-14 Tue> |
> > | Peter | <1970-11-14 Sat> |
> > |---+--|
> >
> > Suppose we want to format time stamps differently, such as with the
> > following elisp commands:
> >
> > (setq org-time-stamp-custom-formats (quote ("<%d %b %y>" . "<%m/%d/%y %a
> > %H:%M>")))
> > (org-toggle-time-stamp-overlays)
> >
> > After realigning the table you get
> >
> > | Name  | Date of Birth|
> > |---+--|
> > | John  | <14 Nov 1978> |
> > | Peter | <14 Nov 1970> |
> > |---+--|
>
> Fixed. Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] org-babel: insert named source block

2017-11-15 Thread Deepak Cherian
Has anyone here managed to configure ivy or helm to show a list of named 
source blocks that org knows about?


I am imagining this workflow:
1. M-x org-babel-insert-named-source-block (imaginary function)
2. List of named source blocks pops up
3. Hit enter and "#+call: name-of-source-block()" is inserted at point.

Thanks,

Deepak



Re: [O] org-mode gets confused with column widths when 'time-stamp-custom-formats' are applied.

2017-11-15 Thread Nicolas Goaziou
Hello,

Ruy Exel  writes:

> Consider the table below:
>
> | Name  | Date of Birth|
> |---+--|
> | John  | <1978-11-14 Tue> |
> | Peter | <1970-11-14 Sat> |
> |---+--|
>
> Suppose we want to format time stamps differently, such as with the
> following elisp commands:
>
> (setq org-time-stamp-custom-formats (quote ("<%d %b %y>" . "<%m/%d/%y %a
> %H:%M>")))
> (org-toggle-time-stamp-overlays)
>
> After realigning the table you get
>
> | Name  | Date of Birth|
> |---+--|
> | John  | <14 Nov 1978> |
> | Peter | <14 Nov 1970> |
> |---+--|

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Table refuses to forget cell formula which once overrode a column formula

2017-11-15 Thread Nicolas Goaziou
Hello,

Ruy Exel  writes:

> The following is very simple org-mode spreadsheet in which the cells in the
> second column show the triple of the corresponding cell in the first column
> due to the "column formula" in its TBLFM row $2=3*$1;N. However the third
> row (actually row @4) is an exception because of the "cell formula"
> @4$2=string("Exception") which expectedly overrides the above column
> formula.
>
> |+---|
> | Number |Triple |
> |+---|
> |  1 | 3 |
> |  2 | 6 |
> |  3 | Exception |
> |  4 |12 |
> |+---|
>
> #+TBLFM: $2=3*$1::@4$2=string("Exception")
>
> So all is well. Below you will find a copy of the above table, except that,
> after copying, I have deleted the exceptional formula affecting cell @4$2.
>
> |+---|
> | Number |Triple |
> |+---|
> |  1 | 3 |
> |  2 | 6 |
> |  3 | Exception |
> |  4 |12 |
> |+---|
>
> #+TBLFM: $2=3*$1
>
> One would expect that, after updating this table with C-u C-c *, or C-c C-c
> in the TBLFM line, the exceptional value in cell @4$2 would revert to the
> triple of '3', but instead the string "Exception" stays put.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] function for inserting a block

2017-11-15 Thread Eric Abrahamsen
"numbch...@gmail.com"  writes:

> I think the function `org-insert-structure-template' also should respect the 
> `org-babel-uppercase-example-markers'.
> Besides, your new diff does not have a condition on 
> `org-babel-uppercase-example-markers', you just use `upcase-initials` by 
> default. Then the new `tempo` snippets
> will be uppercase, but the `org-insert-structure-template` inserted templates 
> will be different.

I'm not entirely understanding you here -- it is
`org-insert-structure-template' that respects
`org-babel-uppercase-example-markers', not the tempo snippet (which was
an omission). And none of the code is using `upcase-initials'.

As far as I can see, the bug is that EXAMPLE is uppercased but the
"begin" and "end" aren't, and also that the tempo snippet doesn't
capitalize at all...



Re: [O] ob-haskell evaluation needs inf-haskell but it does not exist

2017-11-15 Thread Nick Dokos
"numbch...@gmail.com"  writes:

> I checked out your answer, I have meet all your said requirements. GHCi, 
> inf-haskell (after I installed package haskell-mode) and setting 
> `haskell-program-name`, I found there is no
> `defcustom` variable option named `haskell-program-name` at all.

You probably need to set haskell-process-type to ghci. If that works, please 
let me know and I'll update the answer on SO.

>
> [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/
>
> On Wed, Nov 15, 2017 at 9:17 PM, numbch...@gmail.com  
> wrote:
>
> I required `(require 'inf-haskell)` But have not found the command 
> `inf-haskell` to start inferior process.
>
> [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/
>
> On Mon, Nov 13, 2017 at 11:43 PM, Nick Dokos  wrote:
>
> stardiviner  writes:
>
> > When I execute the following Haskell src block:
> >
> > ```
> >
> > #+BEGIN_SRC haskell :session :tangle "Data/Code/hello_world.hs"
> > main :: IO ()
> > main = do
> >   putStrLn "Hello, World!"
> > #+END_SRC
> >
> > ```
> >
> > It reports error:
> >
> > ```
> >
> > Debugger entered--Lisp error: (file-missing "Cannot open load file" 
> "No
> > such file or directory" "inf-haskell")
> >   require(inf-haskell)
>
> See my answer to this SO question:
>
>   
> https://stackoverflow.com/questions/42081379/how-to-set-up-org-babel-for-haskell-with-stack
>
> for some details on setting up the environment.
>
> --
> Nick
>

-- 
Nick




Re: [O] org-hide-emphasis-markers not mentioned in the org manual

2017-11-15 Thread Nick Dokos
alain.coch...@unistra.fr writes:

> Thomas Rikl writes on Tue 14 Nov 2017 14:10:
>
>  > (and perhaps other customization variables)
>  > 
>  > Version: Release 9.1.2 (release 9.1.2-192-gc029c4)
>  > of the org manual
>  > 
>  > regards Thomas R.
>
> In a recent (late sept.)  discussion on this list ("Confused about the
> explanation for 'org-cycle"), it was argued by Org experts that
> documenting every customization variable was not the best way to go.

That's not quite right: it should say

" ... documenting every customization variable *in the manual* was not
the best way to go."

*All* customization variables should be documented. You can get that 
documentation
with

C-h v  RET

If there is no such documentation, that's a bug. You can also use "customize" to
list such variables (or groups of related variables).

The manual is a good way to start, but it does noe wander into the darker 
corners.
Fortunately, emacs provides enough flash lights to illuminate them. Knowing 
about
these is important: it makes your (emacs) life easier, more productive and more
enjoyable.

> So maybe this also applies for the particular case of
> org-hide-emphasis-markers...
>
> Regards

-- 
Nick




Re: [O] How to use case sensitive org-search-view?

2017-11-15 Thread Nicolas Goaziou
Hello,

Tim Cross  writes:

> my 2 cents would vote for a variable which manages case folding. This
> would be in-line with how isearch works and something familiar to most
> Emacs users. I also prefer a single function which behaves differently
> depending on a config variable setting over separate functions as I
> think it makes key binding easier (though admittedly, it is trivial to
> define a lambda which selects between different functions depending on
> the setting of a config variable or prefix arg etc ).

Thinking about it, we may simply drop `org-occur-case-fold-search' and
use `search-upper-case' wherever that makes sense.

So far, "wherever that makes sense" includes:
- `org-occur'
- `org-search-view'
- what else?

WDYT?

Regards,

-- 
Nicolas Goaziou



Re: [O] [rfc] org-dired

2017-11-15 Thread Marco Wahl
Hi!

Nicolas Goaziou  writes:

> Marco Wahl  writes:
>
>> I just pushed the functionality to master.
>
>
> Thank you.
>
> However, I didn't have time to comment the code.
>
> There are a few stylistic issues:
>
>   `mapc' + `lambda' -> `dolist' in `org-attach-attach-files'.

Done.

> However, I think `org-attach-attach-files' can be removed, since it is
> called only once and is really two lines long. IOW, please include it in
> `org-attach-dired-attach-to-next-best-subtree'.

Done.

>   "no window in Org-mode" -> "No window displaying an Org buffer"

Done.

> I don't think it is useful to implement
> `org-attach-dired-attach-to-next-best-subtree-mv'. I assume that once
> `org-attach-method' is set, a user is unlikely to change it for a single
> command. IOW, let's just implement
> `org-attach-dired-attach-to-next-best-subtree'.

Done.

> Nitpick: an inline comment uses a single semicolon.

Okay.

> It would also be better to shorten function names, e.g.
>
>   org-attach-dired-attach-to-next-best-subtree  ->  
> org-attach-dired-to-subtree

Done.

> There are also a few issues in "test-org-attach.el".
>
> For example `touch' uses the wrong name-space. Besides, it is not
> useful.

Removed.

> We usually do
>
>   (org-test-with-temp-text-in-file
> "... Org bufer..."
> (let ((filename (buffer-file-name)))
>  ...))

Okay.

> It would be best to refactor
> `test-org-attach/dired-attach-to-next-best-subtree/1' so that `should'
> is the outer sexp. The cleanup part should probably be in an
> `unwind-protect'. Not that it is not useful if
> °org-test-with-temp-text-in-file'.

I followed you suggestions and I think the new version is cleaner.


Thank you!
  Marco




Re: [O] ob-haskell evaluation needs inf-haskell but it does not exist

2017-11-15 Thread numbch...@gmail.com
I checked out your answer, I have meet all your said requirements. GHCi,
inf-haskell (after I installed package haskell-mode) and setting
`haskell-program-name`, I found there is no `defcustom` variable option
named `haskell-program-name` at all.

[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/

On Wed, Nov 15, 2017 at 9:17 PM, numbch...@gmail.com 
wrote:

> I required `(require 'inf-haskell)` But have not found the command
> `inf-haskell` to start inferior process.
>
> [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/
>
> On Mon, Nov 13, 2017 at 11:43 PM, Nick Dokos  wrote:
>
>> stardiviner  writes:
>>
>> > When I execute the following Haskell src block:
>> >
>> > ```
>> >
>> > #+BEGIN_SRC haskell :session :tangle "Data/Code/hello_world.hs"
>> > main :: IO ()
>> > main = do
>> >   putStrLn "Hello, World!"
>> > #+END_SRC
>> >
>> > ```
>> >
>> > It reports error:
>> >
>> > ```
>> >
>> > Debugger entered--Lisp error: (file-missing "Cannot open load file" "No
>> > such file or directory" "inf-haskell")
>> >   require(inf-haskell)
>>
>> See my answer to this SO question:
>>
>>   https://stackoverflow.com/questions/42081379/how-to-set-up-
>> org-babel-for-haskell-with-stack
>>
>> for some details on setting up the environment.
>>
>> --
>> Nick
>>
>>
>>
>


Re: [O] ob-haskell evaluation needs inf-haskell but it does not exist

2017-11-15 Thread numbch...@gmail.com
I required `(require 'inf-haskell)` But have not found the command
`inf-haskell` to start inferior process.

[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/

On Mon, Nov 13, 2017 at 11:43 PM, Nick Dokos  wrote:

> stardiviner  writes:
>
> > When I execute the following Haskell src block:
> >
> > ```
> >
> > #+BEGIN_SRC haskell :session :tangle "Data/Code/hello_world.hs"
> > main :: IO ()
> > main = do
> >   putStrLn "Hello, World!"
> > #+END_SRC
> >
> > ```
> >
> > It reports error:
> >
> > ```
> >
> > Debugger entered--Lisp error: (file-missing "Cannot open load file" "No
> > such file or directory" "inf-haskell")
> >   require(inf-haskell)
>
> See my answer to this SO question:
>
>   https://stackoverflow.com/questions/42081379/how-to-set-
> up-org-babel-for-haskell-with-stack
>
> for some details on setting up the environment.
>
> --
> Nick
>
>
>


Re: [O] function for inserting a block

2017-11-15 Thread numbch...@gmail.com
I think the function `org-insert-structure-template' also should respect
the `org-babel-uppercase-example-markers'.
Besides, your new diff does not have a condition on
`org-babel-uppercase-example-markers', you just use `upcase-initials` by
default. Then the new `tempo` snippets will be uppercase, but the
`org-insert-structure-template` inserted templates will be different.

[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/

On Wed, Nov 15, 2017 at 5:36 AM, Eric Abrahamsen 
wrote:

> "Thomas S. Dye"  writes:
>
> > Eric Abrahamsen writes:
> >
> >> Rasmus  writes:
> >>
> >>> Hi Eric,
> >>>
> >>> Eric Abrahamsen  writes:
> >>>
> > Also, Eric, it seems that org-structure-template-alist only supports
> a
> > single letter for short-hands (the car of an entry in
> > org-structure-template-alist is a char).  I used to have blocks like
> " > expanding to an "abstract" special-block, which I guess isn’t
> possible
> > anymore?
> 
>  I hadn't thought of that. Really, all I ever wanted was to wrap things
>  in blocks...
> 
>  I don't see any reason why org-structure-template-alist couldn't go
> back
>  to using string keys. Then we could use read-string, and wouldn't have
>  to have special  behavior -- a string that didn't exist in the
>  alist could just be used literally to make a block.
> >>>
> >>> I’d prefer that.  For some special blocks, a few characters might
> makes it
> >>> more intuitive, e.g. "def" → "definition", "hyp" → "hypothesis" etc.
> >>
> >> Here's the simplest solution.
> >>
> >> There still remains the fact that `org-structure-template-alist' has
> >> changed format, and `org-try-structure-completion' no longer exists.
> >> That may still annoy some people who were using the internals of the
> >> process, but...
> >
> > Would something like this work?
> >
> > (defun org-try-structure-completion ()
> >   (tempo-complete-tag))
>
> Here's the newest version!
>
> It incorporates Rasmus' org-tempo.el file, with modifications, and
> Thomas' suggestion to re-instate `org-try-structure-completion', and,
> erm, stardiviner's request to honor
> `org-babel-uppercase-example-markers'.
>
> Remaining issues:
>
> 1. The "org-include" tempo template doesn't work, for reasons I don't
>understand (I've never used tempo before). Nothing happens when I hit
>.
> 2. Now it seems like there should be completion when prompting for a
>string key. Feature creep! But likely worthwhile feature creep.
> 3. I've rather rashly renamed the relevant customization options
>`org-structure-block-alist' (for blocks added via
>`org-insert-structure-template') and `org-structure-keyword-alist'
>(for keywords insertable via the tempo system). Perhaps this was a
>bad idea. If it's not a bad idea, maybe
>`org-insert-structure-template' should be renamed `org-insert-block'
>or something like that.
> 3. Docs need to be updated.
>
> Comments welcome!
>
> Eric
>
>


Re: [O] How to use case sensitive org-search-view?

2017-11-15 Thread Alain . Cochard
Nicolas Goaziou writes on Wed 15 Nov 2017 12:55:

 > alain.coch...@unistra.fr writes:
 > 
 > > Thanks for pointing this out.  But boy is it complicated:
 
 > It is not. [...]

It still is for me, but your explanations do clarify things a bit.

Thanks for your time.


-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France| Fax:   +33 (0)3 68 85 01 25 



Re: [O] How to use case sensitive org-search-view?

2017-11-15 Thread Nicolas Goaziou
Hello,

alain.coch...@unistra.fr writes:

> Thanks for pointing this out.  But boy is it complicated:

It is not. It follows regular isearch in Emacs. Quoting Emacs manual:

   An upper-case letter anywhere in the search string makes the search
case-sensitive.  Thus, searching for ‘Foo’ does not find ‘foo’ or ‘FOO’.
This applies to regular expression search as well as to literal string
search.  The effect ceases if you delete the upper-case letter from the
search string.  The variable ‘search-upper-case’ controls this: if it is
non-‘nil’ (the default), an upper-case character in the search string
make the search case-sensitive; setting it to ‘nil’ disables this effect
of upper-case characters.

> But it does not seem to apply to multi-occur, which 'C-c a /' is said
> to use: both 'C-c a /' and 'M-x multi-occur' for 'FOO' only list
> 'FOO'...

Then it is an issues in Emacs, not in Org specifically. Indeed,
multi-occur's docstrings is

Show all lines in buffers BUFS containing a match for REGEXP.
This function acts on multiple buffers; otherwise, it is exactly like
‘occur’.

and occur's is

If REGEXP contains upper case characters (excluding those preceded by ‘\’)
and ‘search-upper-case’ is non-nil, the matching is case-sensitive.

> From my (user) point of view, I would expect that what is supposed to
> be a regexp behaves like a regexp, and in a consistent way for all
> cases (with 'C-c a s', when filtering with
> org-agenda-filter-by-regexp, etc.).

This is why `org-occur-case-fold-search' is a defcustom. If you set it
to nil, your search obeys to your regexp.

> PS: in the org-occur docstring:

[...]
>The tree will show the lines where the regexp matches, and any
>other context defined in `org-show-context-detail', which see.
>
> the last sentence above looks grammatically/syntactically funny to me.

This is an Emacs idiom. You find it here and there in its manual and
some docstrings. See

for a related discussion in another package.

Regards,

-- 
Nicolas Goaziou



Re: [O] [rfc] org-dired

2017-11-15 Thread Nicolas Goaziou
Hello,

Marco Wahl  writes:

> I just pushed the functionality to master.


Thank you. 

However, I didn't have time to comment the code.

There are a few stylistic issues:

  `mapc' + `lambda' -> `dolist' in `org-attach-attach-files'.  

However, I think `org-attach-attach-files' can be removed, since it is
called only once and is really two lines long. IOW, please include it in
`org-attach-dired-attach-to-next-best-subtree'.

  "no window in Org-mode" -> "No window displaying an Org buffer"

I don't think it is useful to implement
`org-attach-dired-attach-to-next-best-subtree-mv'. I assume that once
`org-attach-method' is set, a user is unlikely to change it for a single
command. IOW, let's just implement
`org-attach-dired-attach-to-next-best-subtree'.

Nitpick: an inline comment uses a single semicolon.

It would also be better to shorten function names, e.g.

  org-attach-dired-attach-to-next-best-subtree  ->  org-attach-dired-to-subtree


There are also a few issues in "test-org-attach.el".

For example `touch' uses the wrong name-space. Besides, it is not
useful. We usually do

  (org-test-with-temp-text-in-file 
"... Org bufer..."
(let ((filename (buffer-file-name)))
 ...))

It would be best to refactor
`test-org-attach/dired-attach-to-next-best-subtree/1' so that `should'
is the outer sexp. The cleanup part should probably be in an
`unwind-protect'. Not that it is not useful if
°org-test-with-temp-text-in-file'.

Regards,

-- 
Nicolas Goaziou



Re: [O] [rfc] org-dired

2017-11-15 Thread Marco Wahl
Nicolas Goaziou  writes:

>> Prepare
>> - In a dired buffer mark files or have the cursor on a file.
>> - Have also an org mode window open.
>> - Place the cursor in an orgee. (Orgee is short for org subtree.)
>> Act
>> - M-x org-dired-attach-hardlinked-to-next-best-orgee
>> Enjoy
>
> Why is hard linking mandatory? Couldn't this function obey to
> `org-attach-method'?
>
>> - Find the files attached to the orgee.
>>
>> Feel free to play with the implementation.
>>
>> WDYT?
>
> According to this description, I think it could be implemented as
> a function within "org-attach.el" instead of a new library.
>
> Also, in the context of Org, an "org subtree" is simply a "subtree".
> I prefer "subtree" over "orgee".

I just pushed the functionality to master.

With the lines

(add-hook
 'dired-mode-hook
 (lambda ()
   (define-key dired-mode-map (kbd "C-c C-x a") 
#'org-attach-dired-attach-to-next-best-subtree)
   (define-key dired-mode-map (kbd "C-c C-x c") 
#'org-attach-dired-attach-to-next-best-subtree-cp)
   (define-key dired-mode-map (kbd "C-c C-x m") 
#'org-attach-dired-attach-to-next-best-subtree-mv)
   (define-key dired-mode-map (kbd "C-c C-x l") 
#'org-attach-dired-attach-to-next-best-subtree-ln)
   (define-key dired-mode-map (kbd "C-c C-x s") 
#'org-attach-dired-attach-to-next-best-subtree-lns)))

in the config file dired gets the functionality on the respective keys.


Critique and improvements welcome, as always, thanks,
 Marco






Re: [O] How to use case sensitive org-search-view?

2017-11-15 Thread Alain . Cochard
Nicolas Goaziou writes on Tue 14 Nov 2017 21:35:

 > Matt Lundin  writes:
 > 
 > > alain.coch...@unistra.fr writes:

 > >> Suppose I have an org file with
 > >>
 > >> * FOO
 > >> * foo
 > >>
 > >> I would like to use org-search-view (C-c a s) so as to (say) list
 > >> only the first entry.
 > >> [...]
 > >> Is there a way to perform what I want?

 > > Unfortunately, it looks like org-search-view is hard-coded to be
 > > case-insensitive. I think a very hackish workaround would be to advise
 > > org-search-view to create and then remove an "around" advice that
 > > wraps re-search-forward in a "let" declaration setting
 > > case-fold-search to nil. But this would be a fairly horrific hack.
 > >
 > > In the long run, I believe the Org Mode code would need to be changed
 > > to make this customizable.


 > Note that there is `org-occur-case-fold-search'.

Thanks for pointing this out.  But boy is it complicated:

I have:

   org-occur-case-fold-search is a variable defined in `org.el'.
   Its value is t

   Documentation:
   Non-nil means `org-occur' should be case-insensitive.
   If set to `smart' the search will be case-insensitive only if it
   doesn't specify any upper case character.

and indeed, if I use

   M-x org-occur  FOO

in my FOO/foo buffer, both instances are found.

But it does not seem to apply to multi-occur, which 'C-c a /' is said
to use: both 'C-c a /' and 'M-x multi-occur' for 'FOO' only list
'FOO'...

 > We could implement something similar with, e.g.,
 > `org-agenda-search-view-case-fold-search'. Or maybe use a variable for
 > every search related function in Org: `org-case-fold-search'.
 > 
 > WDYT?

>From my (user) point of view, I would expect that what is supposed to
be a regexp behaves like a regexp, and in a consistent way for all
cases (with 'C-c a s', when filtering with
org-agenda-filter-by-regexp, etc.).  I would even expect a regexp
search within an Org buffer to behave exactly like a regexp search
within a plain emacs buffer, but I would understand if this not
reasonable to ask for.

Regards,
a.

PS: in the org-occur docstring:

   org-occur is an interactive compiled Lisp function in `org.el'.

   (org-occur REGEXP &optional KEEP-PREVIOUS CALLBACK)

   Make a compact tree which shows all matches of REGEXP.

   The tree will show the lines where the regexp matches, and any
   other context defined in `org-show-context-detail', which see.

the last sentence above looks grammatically/syntactically funny to me.
Maybe this is because of my insufficient level in English -- I just
don't understand what "which see" is supposed to mean.  If the English
is indeed correct, maybe a reformulation would be in order, for the
sake of non native people.






-- 
EOST (École et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France| Fax:   +33 (0)3 68 85 01 25