Bug: [ob-js] error: require(...).print is not a function [9.3 (release_9.3 @ /Users/xcy/src/emacs-mac/lisp/org/)]

2020-12-04 Thread Xu Chunyang
* The issue

ob-js does not work for me, e.g.,

#+begin_src js
1 + 2
#+end_src

throws the error:

/private/var/folders/7f/s191h4q97p90374yw15ssrs0gn/T/babel-gBvsRp/js-script-zTHHhe:1
require('sys').print(require('sys').inspect(function(){
   ^

TypeError: require(...).print is not a function
at Object.
(/private/var/folders/7f/s191h4q97p90374yw15ssrs0gn/T/babel-gBvsRp/js-script-zTHHhe:1:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

* Information

M-! node -v
v14.15.0

Emacs  : GNU Emacs 27.1 (build 2, x86_64-apple-darwin19.6.0, Carbon
Version 162 AppKit 1894.6)
 of 2020-11-11
Package: Org mode version 9.3 (release_9.3 @ /Users/xcy/src/emacs-mac/lisp/org/)

* Another issue: What's SBCL in the commentary?

;;; Commentary:

;; Now working with SBCL for both session and external evaluation.



Re: [O] Json readable error

2018-07-21 Thread Xu Chunyang


Doyley, Marvin M. writes:

> Hi there,
>
> For some strange reason whenever I switch to org-mode (M-x org-mode), I get 
> json readtable error: 84, which I have been trying to resolve without much 
> success.
>
> Have anyone encountered this before or know how to resolve it?  This problem 
> could be due to recent change that I have made to my default python (changed 
> from anaconda 3.4 to intel’s python 3.4), but I am not sure why doing this 
> would cause a problem.
>
> Best Wishes,
> M
>
> Here is the backtrace.
>
> Debugger entered--Lisp error: (json-readtable-error 84)
>   signal(json-readtable-error (84))
>   json-read()
>   json-read-array()
>   json-read()
>   json-read-from-string("[TerminalIPythonApp] WARNING | Subcommand `ipython 
> kernelspec` is deprecated and will be removed in future 
> versions.\n[TerminalIPythonApp] WARNING | You likely want to use `jupyter 
> kernelspec` in the future\n{\n  \"kernelspecs\": {\n\"python3\": {\n  
> \"resource_dir\": \"/anaconda/share/jupyter/kernels/python3\",\n  
> \"spec\": {\n\"argv\": [\n  \"/anaconda/bin/python\",\n   
>\"-m\",\n  \"ipykernel_launcher\",\n  \"-f\",\n  
> \"{connection_file}\"\n],\n\"env\": {},\n
> \"display_name\": \"Python 3\",\n\"language\": \"python\",\n
> \"interrupt_mode\": \"signal\",\n\"metadata\": {}\n  }\n}\n  
> }\n}\n")
>   ob-ipython--get-kernels()
>   ob-ipython-auto-configure-kernels()
>   run-hooks(change-major-mode-after-body-hook text-mode-hook 
> outline-mode-hook org-mode-hook)
>   apply(run-hooks (change-major-mode-after-body-hook text-mode-hook 
> outline-mode-hook org-mode-hook))
>   run-mode-hooks(org-mode-hook)
>   org-mode()
>   funcall-interactively(org-mode)
>   call-interactively(org-mode record nil)
>   command-execute(org-mode record)
>   helm-M-x(nil #("org-mode" 0 8 (match-part "org-mode")))
>   funcall-interactively(helm-M-x nil #("org-mode" 0 8 (match-part 
> "org-mode")))
>   call-interactively(helm-M-x nil nil)
>   command-execute(helm-M-x)

I encountered the same issue a few days ago, it is due to python version
upgrade (jupyter no longer worked) and ob-ipython.el doesn't handle
error very well, and ob-ipython.el also installs some code on
org-mode-hook unconditionally. I simply delete ob-ipython.el and delete
configuration of it in the init.el, then restart Emacs, since I've
not used ob-ipython.el for a long time.



[O] Bug: ob-python: Lots of IndentationError [9.1.12 (release_9.1.12-728-ge8a4f3 @ /Users/xcy/src/org-mode/lisp/)]

2018-05-07 Thread Xu Chunyang
Execute this code block

#+BEGIN_SRC python :session :results value
  def int2str(i):
  digits = "0123456789"
  if i == 0:
  return "0"
  else:
  result = ""
  while i > 0:
  result = digits[i % 10] + result
  i = i // 10
  return result


  int2str(123)
#+END_SRC

I get lots of IndentationError in *Python*

#+begin_example
def int2str(i):
Python 3.6.5 (default, Mar 30 2018, 06:41:53) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
digits = "0123456789"
>>> if i == 0:
... return "0"
... 
... else:
... result = ""
>>> while i > 0:
  File "", line 1
else:
^
IndentationError: unexpected indent
result = digits[i % 10] + result
>>> i = i // 10
  File "", line 1
result = ""
^
IndentationError: unexpected indent

>>> return result
  File "", line 1
while i > 0:
^
IndentationError: unexpected indent

>>> 
  File "", line 1
result = digits[i % 10] + result
^
IndentationError: unexpected indent
int2str(123)
>>> 
  File "", line 1
i = i // 10
^
IndentationError: unexpected indent
open('/var/folders/7f/s191h4q97p90374yw15ssrs0gn/T/babel-1ZV0Jv/python-Q0QwFi',
 'w').write(str(_))
>>> 
>>> 
  File "", line 1
return result
^
IndentationError: unexpected indent
'org_babel_python_eoe'
>>> Traceback (most recent call last):
  File "", line 1, in 
NameError: name '_' is not defined
>>> 'org_babel_python_eoe'
>>> 
#+end_example


By the way, the implementation of ob-python.el is not very robust. For
example, it contains

#+BEGIN_SRC emacs-lisp
(dolist (line (split-string body "[\r\n]"))
  ;; Insert a blank line to end an indent
  ;; block.
  ...)
#+END_SRC

it looks very strange to me, since Emacs Lisp doesn't understand Python
code, for example, it might end up inserting a newline within a Python
string.  And another inconvenience is non-session code block requires
'return' but session code block does not, in my opinion, requiring a
'return' is a very bad idea since by inserting a 'return', the python
code will be invalid.  I suggest someone who is familiar with Org &
Python to review the implementation of ob-python.el, I guess python.el
already has exiting solution on how to sending a block of python code to
comint-mode, and elpy-shell.el[1] also knows how to capture return value
of a python code block. More elegant and reliable solution might already
exists.


[1]: https://github.com/jorgenschaefer/elpy/blob/master/elpy-shell.el


Emacs  : GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.5.0, NS 
appkit-1561.40 Version 10.13.4 (Build 17E199))
 of 2018-05-05
Package: Org mode version 9.1.12 (release_9.1.12-728-ge8a4f3 @ 
/Users/xcy/src/org-mode/lisp/)



[O] Bug: org-agenda-tags-column does not work anymore [9.1.12 (release_9.1.12-677-g4c13d0 @ /Users/xcy/src/org-mode/lisp/)]

2018-04-28 Thread Xu Chunyang
Hi,

I'm using latest Org mode built from latest git repository, the HEAD
is 4c13d0a1a870a450627ce1d8449a3b7204202250. I notice tags are no longer
aligned in *Org Agenda*.

It seems the issue is introduced by

e87ebca2a755620a13a49cc748ba987b17d2d64d Use `org-tag-line-re'

and the following patch fixes it for me

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 342ea06b7..2ad09c1ad 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9003,7 +9003,7 @@ If FORCE-TAGS is non nil, the car of it returns the new 
tags."
l c)
 (save-excursion
   (goto-char (if line (line-beginning-position) (point-min)))
-  (while (re-search-forward org-tag-line-re (and line (line-end-position)) 
t)
+  (while (re-search-forward org-tag-group-re (and line 
(line-end-position)) t)
(add-text-properties
 (match-beginning 1) (match-end 1)
 (list 'face (delq nil (let ((prop (get-text-property



[O] Bug: A typo in org-eww-copy-for-org-mode's docstring [9.1.11 (release_9.1.11-623-gbecbef @ /Users/xcy/src/org-mode/lisp/)]

2018-04-25 Thread Xu Chunyang

'C-h f org-eww-copy-for-org-mode' has the following

and insert the transformed test into the kill ring

"test" should be "text".



[O] Bug: 'M-x org-tags-view c-g' not exit gracefully [9.1.9 (release_9.1.9-574-g348552 @ /Users/xcy/src/org-mode/lisp/)]

2018-04-07 Thread Xu Chunyang
After 'M-x org-tags-view c-g', there is a empty buffer named *Org Agenda*
left, which is unwanted to me.



Re: [O] Bug: [ob-clojure] Surprising evaluation result [9.1.6 (release_9.1.6-491-g70b029 @ /Users/xcy/src/org-mode/lisp/)]

2018-03-03 Thread Xu Chunyang
"numbch...@gmail.com"  writes:

> No, it's not expected result. It should be caused by my commit here
> https://code.orgmode.org/bzg/org-mode/pulls/5

I don't think so, your pull request is about ob-clojure-literate, while
I am talking about ob-clojure. I want to know what authors of ob-clojure
think about the behavior, is it a Bug?

> Don't know how to workaround this.

As for workaround, I have the following in my init.el

(define-advice org-babel-expand-body:clojure (:filter-return (body) do)
  (format "(do %s)" body))

[...]



[O] Bug: [ob-clojure] Surprising evaluation result [9.1.6 (release_9.1.6-491-g70b029 @ /Users/xcy/src/org-mode/lisp/)]

2018-03-01 Thread Xu Chunyang
Hello all,

I run the following Clojure code with CIDER as the backend. The result
is surprising to me:

#+begin_src clojure
(* 6 7)
(= nil ())
#+end_src

#+RESULTS:
: 42false

As you can see, the result is the concatenation of the value of each
expression. Is it expected? I would like to get only the value of the
last expression, i.e., false.


--
Org   release_9.1.7-440-g5e8fa1361
CIDER v0.16.0-83-g88f4fcf
Emacs 27.0.50



[O] [PATCH] org-agenda: Disable message logging for some messages

2018-01-12 Thread Xu Chunyang

* lisp/org-agenda.el (org-agenda-filter-by-tag):
(org-agenda-view-mode-dispatch):
(org-agenda-diary-entry):
(org-agenda-bulk-action): Disable message logging for some messages.
---

When under the *Org Agenda* buffer, my *Messages* buffer is filled
quickly by these "prompt"-like messages, I prefer they are not written to
the *Messages* buffer.

lisp/org-agenda.el | 40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index b2729c1ca..6d04c8d35 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7535,12 +7535,13 @@ also press `-' or `+' to switch between filtering and 
excluding."
 a n tag)
 (unless char
   (while (not (memq char valid-char-list))
-   (message
-"%s by tag [%s ]:tag-char, [TAB]:tag, %s[/]:off, 
[+/-]:filter/exclude%s, [q]:quit"
-(if exclude "Exclude" "Filter")
-tag-chars
-(if org-agenda-auto-exclude-function "[RET], " "")
-(if expand "" ", no grouptag expand"))
+   (let ((message-log-max nil))
+ (message
+  "%s by tag [%s ]:tag-char, [TAB]:tag, %s[/]:off, 
[+/-]:filter/exclude%s, [q]:quit"
+  (if exclude "Exclude" "Filter")
+  tag-chars
+  (if org-agenda-auto-exclude-function "[RET], " "")
+  (if expand "" ", no grouptag expand")))
(setq char (read-char-exclusive))
;; Excluding or filtering down
(cond ((eq char ?-) (setq exclude t))
@@ -7976,9 +7977,10 @@ With prefix ARG, go backward that many times the current 
span."
 (defun org-agenda-view-mode-dispatch ()
   "Call one of the view mode commands."
   (interactive)
-  (message "View: [d]ay  [w]eek  for[t]night  [m]onth  [y]ear  [SPC]reset  
[q]uit/abort
+  (let ((message-log-max nil))
+(message "View: [d]ay  [w]eek  for[t]night  [m]onth  [y]ear  [SPC]reset  
[q]uit/abort
   time[G]rid   [[]inactive  [f]ollow  [l]og[L]og-all   [c]lockcheck
-  [a]rch-trees [A]rch-files clock[R]eport include[D]iary   
[E]ntryText")
+  [a]rch-trees [A]rch-files clock[R]eport include[D]iary   
[E]ntryText"))
   (pcase (read-char-exclusive)
 (?\ (call-interactively 'org-agenda-reset-view))
 (?d (call-interactively 'org-agenda-day-view))
@@ -9578,7 +9580,8 @@ entries in that Org file."
   (org-agenda-diary-entry-in-org-file)
 (require 'diary-lib)
 (let* ((char (progn
-  (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early 
[a]nniversary [b]lock [c]yclic")
+  (let ((message-log-max nil))
+(message "Diary entry: [d]ay [w]eekly [m]onthly [y]early 
[a]nniversary [b]lock [c]yclic"))
   (read-char-exclusive)))
   (cmd (cdr (assoc char
'((?d . diary-insert-entry)
@@ -9862,15 +9865,16 @@ The prefix arg is passed through to the command if 
possible."
   (user-error "Marker %s for bulk command is invalid" m)))
 
   ;; Prompt for the bulk command.
-  (message
-   (concat (if org-agenda-persistent-marks "Bulk (persistent): " "Bulk: ")
-  "[$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [d]eadline [r]efile "
-  "[S]catter [f]unction"
-  (and org-agenda-bulk-custom-functions
-   (format " Custom: [%s]"
-   (mapconcat (lambda (f) (char-to-string (car f)))
-  org-agenda-bulk-custom-functions
-  "")
+  (let ((message-log-max nil))
+(message
+ (concat (if org-agenda-persistent-marks "Bulk (persistent): " "Bulk: ")
+"[$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [d]eadline [r]efile "
+"[S]catter [f]unction"
+(and org-agenda-bulk-custom-functions
+ (format " Custom: [%s]"
+ (mapconcat (lambda (f) (char-to-string (car f)))
+org-agenda-bulk-custom-functions
+""))
   (catch 'exit
 (let* ((org-log-refile (if org-log-refile 'time nil))
   (entries (reverse org-agenda-bulk-marked-entries))
-- 
2.15.1




[O] https://orgmode.org/ loads google font css through http

2018-01-08 Thread Xu Chunyang
Hi,

The source of https://orgmode.org/ contains the following

#+begin_src html
http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic|Droid+Sans=latin"
 rel="stylesheet" type="text/css" />
#+end_src

My web browser (Chrome) refuses to load it and shows a warning in the
address bar.



[O] [PATCH] * contrib/manual.org: Add org-capture-templates to Variable Index

2018-01-05 Thread Xu Chunyang
---

I notice 'C-h S' ('info-lookup-symbol') can't find
'org-capture-templates', adding the variable to (info "(org) Variable
Index") should fix this issue.

I don't know if I should change org.texi instead or both of them.

 contrib/manual.org | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/manual.org b/contrib/manual.org
index a9c546ebc..a57114401 100644
--- a/contrib/manual.org
+++ b/contrib/manual.org
@@ -7114,6 +7114,7 @@ is through the customize interface.
 - {{{kbd(C-c c C)}}} ::
 
  #+kindex: C-c c C
+ #+vindex: org-capture-templates
  Customize the variable ~org-capture-templates~.
 
 Before we give the formal description of template definitions, let's
-- 
2.15.1