Re: [O] src block: 'C-c C-c can do nothing useful here' if cursor on blank line
Hello, "Charles C. Berry"writes: > Nor I. Perhaps it was just an oversight. > > FWIW, in `org-ctrl-c-ctrl-c' > > :(looking-at-p "[ \t]*$") > > could be > > #+BEGIN_SRC emacs-lisp >(and > (looking-at-p "[ \t]*$") > (not (eq 'src-block (org-element-type (org-element-context)) > #+END_SRC > > without causing a lot of grief. I think `src-block' is the only > relevant case. In almost all cases, you don't want C-c C-c to do anything on a blank line. Commit 0b6a2e2416b0acc28469661d7013f92f82a34267 pointed out before was pushed because calling C-c C-c on the blank lines right after a blank line would call `org-set-tags'. What you suggest is sub-optimal, tho. The point of this quick check is to eschew `org-element-context' call a few lines below. This would make two calls instead of one. I think a proper solution is to bite the bullet and make the check after calling `org-element-context', in a pcase branch. This is what I did in ebb9da0d0. Please let me know if it doesn't solve the issue. Regards, -- Nicolas Goaziou
Re: [O] src block: 'C-c C-c can do nothing useful here' if cursor on blank line
On Fri, 27 Jan 2017, Kyle Meyer wrote: Eric S Fragawrites: On Friday, 27 Jan 2017 at 18:44, John Hendy wrote: Perhaps this is the intended behavior, but I noticed that I go to execute a code block and get the message "C-c C-c can do nothing useful here" if I'm not on the actual src block definition or a line of code. If I'm on a blank line inside it, it doesn't execute. Here was my test: I have noticed this recently as well. Not sure if it was always the case, mind you, but it would be nice if C-c C-c would work even when the cursor is on a blank line (within a src block, that is). I think this changed with 0b6a2e241 (C-c C-c does nothing when at a blank line, 2013-02-15). I wasn't able to figure out the motivation for that change. Nor I. Perhaps it was just an oversight. FWIW, in `org-ctrl-c-ctrl-c' :(looking-at-p "[ \t]*$") could be #+BEGIN_SRC emacs-lisp (and (looking-at-p "[ \t]*$") (not (eq 'src-block (org-element-type (org-element-context)) #+END_SRC without causing a lot of grief. I think `src-block' is the only relevant case. Chuck
Re: [O] src block: 'C-c C-c can do nothing useful here' if cursor on blank line
Eric S Fragawrites: > On Friday, 27 Jan 2017 at 18:44, John Hendy wrote: >> Perhaps this is the intended behavior, but I noticed that I go to >> execute a code block and get the message "C-c C-c can do nothing >> useful here" if I'm not on the actual src block definition or a line >> of code. If I'm on a blank line inside it, it doesn't execute. Here >> was my test: > > I have noticed this recently as well. Not sure if it was always the > case, mind you, but it would be nice if C-c C-c would work even when the > cursor is on a blank line (within a src block, that is). I think this changed with 0b6a2e241 (C-c C-c does nothing when at a blank line, 2013-02-15). I wasn't able to figure out the motivation for that change. -- Kyle
Re: [O] src block: 'C-c C-c can do nothing useful here' if cursor on blank line
On Friday, 27 Jan 2017 at 18:44, John Hendy wrote: > Perhaps this is the intended behavior, but I noticed that I go to > execute a code block and get the message "C-c C-c can do nothing > useful here" if I'm not on the actual src block definition or a line > of code. If I'm on a blank line inside it, it doesn't execute. Here > was my test: I have noticed this recently as well. Not sure if it was always the case, mind you, but it would be nice if C-c C-c would work even when the cursor is on a blank line (within a src block, that is). -- : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.3-241-gc3d67b signature.asc Description: PGP signature
Re: [O] src block: 'C-c C-c can do nothing useful here' if cursor on blank line
I get this all the time too. It would be nice if it went away, I also find it annoying. John Hendy writes: > Perhaps this is the intended behavior, but I noticed that I go to > execute a code block and get the message "C-c C-c can do nothing > useful here" if I'm not on the actual src block definition or a line > of code. If I'm on a blank line inside it, it doesn't execute. Here > was my test: > > #+begin min_config > > (add-to-list 'load-path "~/.elisp/org/lisp/") > (add-to-list 'load-path "~/.elisp/org/contrib/lisp") > > (org-babel-do-load-languages > 'org-babel-load-languages > '((R . t))) > > #+end > > Start with =emacs -Q= and then =M-x load-file RET > ~/path/to/min-config=, then use this test file: > > * heading > > #+begin_src R > ^ > x <- 1:10 > x > > #+end_src > > With the cursor at ^ it won't run. I would understand if this were in > interactive mode using =C-c '=, but the behavior of C-c C-c is to run > the whole block anyway. It seems like Org doesn't know I'm in a src > block. Since blank lines are common, I'd expect not to have to make > *sure* I'm on an actual line of code and that being anywhere in a src > block should work. > > Thoughts? > > > Thanks, > John -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
[O] src block: 'C-c C-c can do nothing useful here' if cursor on blank line
Perhaps this is the intended behavior, but I noticed that I go to execute a code block and get the message "C-c C-c can do nothing useful here" if I'm not on the actual src block definition or a line of code. If I'm on a blank line inside it, it doesn't execute. Here was my test: #+begin min_config (add-to-list 'load-path "~/.elisp/org/lisp/") (add-to-list 'load-path "~/.elisp/org/contrib/lisp") (org-babel-do-load-languages 'org-babel-load-languages '((R . t))) #+end Start with =emacs -Q= and then =M-x load-file RET ~/path/to/min-config=, then use this test file: * heading #+begin_src R ^ x <- 1:10 x #+end_src With the cursor at ^ it won't run. I would understand if this were in interactive mode using =C-c '=, but the behavior of C-c C-c is to run the whole block anyway. It seems like Org doesn't know I'm in a src block. Since blank lines are common, I'd expect not to have to make *sure* I'm on an actual line of code and that being anywhere in a src block should work. Thoughts? Thanks, John