felko / neuron-mode

An emacs mode for editing Zettelkasten notes with neuron
GNU General Public License v3.0
118 stars 21 forks source link

Ignore log messages in output of 'neuron query' #68

Closed ednolan closed 3 years ago

ednolan commented 3 years ago

For reference, see this issue in the main neuron repo: https://github.com/srid/neuron/issues/503

Neuron has added some log messages to the output of neuron query. This breaks neuron-mode. I filed an issue with neuron about this, and now the log messages go to stderr instead of stdout. However, because of how neuron-mode uses call-process-shell-command, these log messages are still picked up as part of the neuron query, which breaks neuron-mode.

I patched my own copy of neuron-mode in the following way, which fixes the issue when used with the newest version of neuron:

@@ -297,7 +297,7 @@ URI is expected to have a zquery:/ scheme."
 The command is executed as a synchronous process and the standard output is
 returned as a string."
   (let* ((result    (with-temp-buffer
-                      (list (call-process-shell-command cmd nil t) (buffer-string))))
+                      (list (call-process-shell-command (concat cmd " 2>/dev/null") nil t) (buffer-string))))
          (exit-code (nth 0 result))
          (output    (nth 1 result)))
     (if (equal exit-code 0)

However, I'm not an expert on emacs lisp, and I imagine there is probably a more idiomatic way of doing this, so I didn't create a PR with that change.

felko commented 3 years ago

Thanks for reporting, I just tried https://github.com/felko/neuron-mode/commit/81ed1f3288eab9aed2cb0b1eb11af69f988b7d0b and it appears to work well with the latest neuron version.

ednolan commented 3 years ago

Thanks for the fix!