bug#45091: 27.1; M-x org-table-paste-rectangle

2021-01-15 Thread Naoya Yamashita


> Okay, your bisect scripts points to one of my commits.
> 
> But I wish it was more automated.  Because I tried quite
> hard and sometimes I _could_ reproduce the problem and
> sometimes I couldn't.  So you could be seeing noise here.
> Maybe you can make your script  do those copy-paste
> operations automatically and reliably?  Then we'd be sure.
> 
> Anyway, I think is might be enough to point to a bug
> that was introduced by my commit, or rather exposed
> by it.  I'll have another look.

Sorry, you're true.  I try to build (semi-)automatically
reproduce step and do bisect with it, I got different commit.

It is 165f7383822086d465519ebe6e4283723923f097 (Update Org to 9.3).

(I wanted to reproduce the problem completely in auto, but the
problem is related to Emacs font-lock and post-command-hook, and
I could not reproduce it with --batch.  If you know how to
partially pass control to Emacs main-loop while running Elisp,
please tell me that.)


## Repro step

1. Prepare below contents.

```latex <~/dev/tmp/taks-file.tex>
-*- mode: latex -*-

| rownames|  acq |
| ref-coal-krt-2000-4-s1@4104 | 4104 |
| ref-coal-krt-2000-4-s1@4105 | 4105 |

|+++---+-+-+-+--+--|
|| 12C12C | 12C14N | 12C14Nz12C12C | d13Cion | d15Nion 
| N/C | d13C | d15N |
|+++---+-+-+-+--+--|
| !cniso-mtx-ogl1-2@4112 |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4113  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4114  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4115  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4116  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4117  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4118  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4119  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4124  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4125  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4126  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4127  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4128  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4129  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4130  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4131  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4132  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4133  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4134  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4135  |||   | | 
| |  |  |
| cniso-mtx-ogl1-2@4136  |||   | | 
| |  |  |
|+++---+-+-+-+--+--|
```

```sh <~/dev/tmp/bisect-script.sh>
git clean -fdx
make clean
./autogen.sh
./configure --prefix=$HOME/.local/head
make -j6
./src/emacs -Q ~/dev/tmp/taks-file.tex --eval "
  (progn
(setq truncate-lines t)
(setq debug-on-error t)
(require 'org)
(require 'org-table)
(orgtbl-mode)

(search-forward \"|\")
(org-table-copy-region (1+ (org-table-begin)) (- (org-table-end) 2))

(search-forward \"!\")

(global-set-key (kbd \"\")
  (lambda ()
(interactive)
(org-table-paste-rectangle)
(set-buffer-modified-p nil)
(condition-case e
(insert \"text\")
  (error
   (kill-emacs 1)))
(kill-emacs 0)))
)" \
2>/dev/null
```

2. Do below command in terminal
```sh
git bisect start emacs-27.1 emacs-26.3
git bisect run ~/dev/tmp/bisect-script.sh
```

3. Wait for build and wake Emacs, then press .

4. Got commit it has some problem.
(I got bellow bisect log in Magit)
```
Bisect Log (15)
git bisect start 'emacs-27.1' 'emacs-26.3'
git bisect good 38564f8a664347c42f7614d9c91e0d49e4a073e8
git bisect good 825fd4d34165e5edc718a9df93838a410d25ea81
git bisect good 5c5c1b559313d06aab6516ff1b1acf1da3a01c7d
git bisect bad d7cd4ab7d948427104003f1d35cf52a4eac45d0a

bug#45091: 27.1; M-x org-table-paste-rectangle

2021-01-15 Thread Naoya Yamashita


Hi, I'm new on this thread, but I can reproduce tak's issue and I
tried to do bisect.

Finally, I got 5b45c269cda09fe46e110adb6f6767040f4ade59 is a
commit has a some problem.

I'm happy if this information could help you.

```
5b45c269cda09fe46e110adb6f6767040f4ade59
New jit-lock-antiblink-grace feature

* lisp/jit-lock.el (jit-lock-antiblink-grace): New defcustom.
(jit-lock--antiblink-line-beginning-position)
(jit-lock--antiblink-string-or-comment): New variables
(jit-lock--antiblink-post-command): New helper.
(jit-lock-mode): Tweak post-command-hook and
jit-lock-context-timer.

* etc/NEWS: Mention jit-lock-antiblink-grace

2 files changed, 81 insertions(+), 1 deletion(-)
etc/NEWS |  7 ++
lisp/jit-lock.el | 75 +++-
```

---

Here is my bash script and do `C-c l` (org-table-copy-region) on
first table and `C-c ;` (org-table-paste-rectangle) on second table.
(~/dev/tmp/taks-file.tex have first tak's mention contents.)

```sh
make clean
./autogen.sh
./configure --prefix=$HOME/.local/head
make -j6
./src/emacs -Q ~/dev/tmp/taks-file.tex --eval " \
  (progn\
(setq truncate-lines t) \
(setq debug-on-error t) \
(require 'org)  \
(require 'org-table)\
(orgtbl-mode)   \
(global-set-key (kbd \"C-c l\") \
   (lambda ()   \
 (interactive)  \
 (org-table-copy-region (1+ (org-table-begin)) (- (org-table-end) 2 
\
(global-set-key (kbd \"C-c ;\") \
   (lambda ()   \
 (interactive)  \
 (org-table-paste-rectangle)\
 (set-buffer-modified-p nil"\
2>/dev/null
```

And here is my bisect log.
```
Bisect Log (14)
git bisect start 'emacs-27.1' 'emacs-26.3'
git bisect good 38564f8a664347c42f7614d9c91e0d49e4a073e8
git bisect good 825fd4d34165e5edc718a9df93838a410d25ea81
git bisect good 5c5c1b559313d06aab6516ff1b1acf1da3a01c7d
git bisect bad d7cd4ab7d948427104003f1d35cf52a4eac45d0a
git bisect bad 4b2c2faab83fe3b13430b837be7d450b5cd47caf
git bisect good 16ce6dbef279bda70b4d60b4d2d0aff008bfa5f7
git bisect bad 5063e38921de8cb872965abda32bcc6fd8894532
git bisect bad 4c933077157ba409d645f4649c8a3a8e534d53d5
git bisect good 096be9c4541329af259273fe604dc4f8669fbd8a
git bisect bad bd95d66ae97f3dcfe73b972de935e27e434e49be
git bisect bad 5b45c269cda09fe46e110adb6f6767040f4ade59
git bisect good 0e774d4f355b4f12a625da5ca9602d1ba876bcc1
5b45c269cda09fe46e110adb6f6767040f4ade59 is the first bad commit
```





Re: [PATCH] Add org-md-src-block for src-block formater

2020-08-27 Thread Naoya Yamashita
> This is a feature. "ox-md" exports to vanilla Markdown, which doesn't
> support such syntax. You may want to use other back-ends, e.g.,
> "ox-gfm".

Thanks for letting me know that. I would try it.

2020年8月27日(木) 14:34 Nicolas Goaziou :

> Hello,
>
> Naoya Yamashita  writes:
>
> > I found `ox-md` exporter drop src-block language information.
> > My patch fixes the behavior.
>
> This is a feature. "ox-md" exports to vanilla Markdown, which doesn't
> support such syntax. You may want to use other back-ends, e.g.,
> "ox-gfm".
>
> Regards,
> --
> Nicolas Goaziou
>


[PATCH] Add org-md-src-block for src-block formater

2020-08-26 Thread Naoya Yamashita
Hi,
I found `ox-md` exporter drop src-block language information.
My patch fixes the behavior; to embed src-block language information
using markdown src block grammar.

1. Open some buffer
2. Tnsert below code
3. Turn on `org-mode`
4. `C-c C-e m M` (export as markdown in temp buffer)

## org source
```org
#+begin_src python
print(1 + 2)
#+end_src

#+begin_src emacs-lisp
(print "hello")
#+end_src

#+begin_src
something source code
#+end_src
```

## before
```markdown

# Table of Contents



print(1 + 2)

(print "hello")

something source code

```

## after
```markdown

# Table of Contents



```python
print(1 + 2)
```

```emacs-lisp
(print "hello")
```

```
something source code
```

```
From 0ffa1f8f6dede26b7f1e8ce4afc1fbcd2f45755b Mon Sep 17 00:00:00 2001
From: conao3 
Date: Thu, 27 Aug 2020 13:52:50 +0900
Subject: [PATCH] Add org-md-src-block for src-block formater

* lisp/ox-md.el (org-md-src-block): Add new formater for src block
* lisp/ox-md.el (org-export-define-derived-backend 'md): use it
---
 lisp/ox-md.el | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 1d20c04f4..59db0c765 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -110,7 +110,7 @@ The %s will be replaced by the footnote reference itself."
 		 (quote-block . org-md-quote-block)
 		 (section . org-md-section)
 		 (special-block . org-md--convert-to-html)
-		 (src-block . org-md-example-block)
+		 (src-block . org-md-src-block)
 		 (table . org-md--convert-to-html)
 		 (template . org-md-template)
 		 (verbatim . org-md-verbatim))
@@ -331,6 +331,18 @@ channel."
(org-remove-indentation
 (org-export-format-code-default example-block info
 
+(defun org-md-src-block (src-block _contents info)
+  "Transcode SRC-BLOCK element into Markdown format.
+CONTENTS is nil.  INFO is a plist used as a communication
+channel."
+  (let ((lang (pcase (plist-get info :parse-tree)
+(`(org-data ,_ (section ,_ (src-block (:language ,l . ,_ l
+(format
+ "```%s\n%s```"
+ (or lang "")
+ (org-remove-indentation
+  (org-export-format-code-default src-block info)
+
 (defun org-md-export-block (export-block contents info)
   "Transcode a EXPORT-BLOCK element from Org to Markdown.
 CONTENTS is nil.  INFO is a plist holding contextual information."
-- 
2.28.0



Not working ob-C sample code

2020-06-22 Thread Naoya Yamashita
Hi! I'm Naoya. This is the first mail to this ML.

First, thank you for developing such awesome packages!

I found ob-C sample[1] is not working for me, I report that to this ML.

[1]: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-C.org.html

## Repro step
1. Require org and ob-C.
2. Write below in some org buffer.
```org
#+tblname: somedata
| nb| sqr | noise |
|---+-+---|
| zero  |   0 |  0.23 |
| one   |   1 |  1.31 |
| two   |   4 |  4.61 |
| three |   9 |  9.05 |
| four  |  16 | 16.55 |

#+name: c-table
#+header: :exports results
#+begin_src C++ :var somedata=somedata
  int main()
  {
for (int i=0; i’; did you forget to ‘#include ’?
  +++ |+#include 
1 |
/tmp/babel-kMPbac/C-src-KDQDdx.cpp: In function ‘int main()’:
/tmp/babel-kMPbac/C-src-KDQDdx.cpp:27:5: error: ‘printf’ was not declared
in this scope
   27 | printf ("%2d %7s ", i, somedata_h(i,"nb"));
  | ^~
/tmp/babel-kMPbac/C-src-KDQDdx.cpp:1:1: note: ‘printf’ is defined in header
‘’; did you forget to ‘#include ’?
  +++ |+#include 
1 |
/tmp/babel-kMPbac/C-src-KDQDdx.cpp:30:38: error: ‘atof’ was not declared in
this scope
   30 |   printf ("%5s %5g ", cell, 1000*atof(cell));
  |  ^~~~
zsh:1: permission denied: /tmp/babel-kMPbac/C-bin-EfCzWt
```

## Some note
- These errors caused because a lack to include some library.
  - Add some include statement generate and insert it in
`org-babel-C-utility-header-to-C`?
  - Add new option for a user preamble and insert it in
`org-babel-C-expand-C`?

Regards,