Giter Site home page Giter Site logo

Comments (5)

hexmode avatar hexmode commented on September 27, 2024 3

I just came across this using emacs HEAD (a06c13db9eee0487975177089b44198dd08206be) and saw some "Selecting deleted buffer" messages which led me to this bug. it does appear to be related to sqlite.

Emacs 28 (the version I can get easily from Debian) works without a problem.

My minimal init.el to reproduce this is:

(let ((bootstrap-file
        (expand-file-name "straight/repos/straight.el/bootstrap.el"
			    user-emacs-directory))
       (bootstrap-version 5)
       (straight-url (concat "https://raw.githubusercontent.com/raxod502/"
			                 "straight.el/develop/install.el")))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
	    (url-retrieve-synchronously straight-url
				'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (message (concat "got " bootstrap-file))
  (load bootstrap-file nil 'nomessage))
(declare-function straight-use-package (expand-file-name "~/.emacs.d/straight/repos/straight.el/straight.el"))
(straight-use-package 'use-package)

(use-package magit
  :bind (("C-x v d" . magit-status))
  :ensure t
  :init
  (fset 'vc-dir 'magit-status)
  :custom
  (magit-diff-refine-hunk t)
  (magit-diff-refine-ignore-whitespace t)
  ; maybe change to a numger if this is too heavy
  (magit-diff-adjust-tab-width t))

(use-package forge
  :straight t
  :after magit)

from emacsql.

MassimoLauria avatar MassimoLauria commented on September 27, 2024

I have the same issue with Magit and disabling Forge temporarily fixed it. I only have the issue on MacOS, but I don't have it on Linux.

from emacsql.

tarsius avatar tarsius commented on September 27, 2024

I am guessing that there was some fatal error when running the executable. That causes the process sentinel to be run and that kills the process buffer unconditionally, which in this case is premature because emacsql-waiting-p will still try to access the buffer.

Changing that function to the following should address that:

(cl-defmethod emacsql-waiting-p ((connection emacsql-protocol-mixin))
  "Return t if the end of the buffer has a properly-formatted prompt.
Also return t if the process has terminated."
  (let ((buffer (emacsql-buffer connection)))
    (or (not (buffer-live-p buffer))
        (with-current-buffer buffer
          (and (>= (buffer-size) 2)
               (string= "#\n"
                        (buffer-substring (- (point-max) 2) (point-max))))))))

However, that won't show the error message about why the executable could not be run. (You probably will get an error about a timeout, but that probably isn't correct, given that you didn't mention a hang.) The process sentinel should probably be changed to raise an error itself, but I don't know what such an error would look like, so please also apply this patch:

diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el
index b14d1ac..58f2f5a 100644
--- a/emacsql-sqlite.el
+++ b/emacsql-sqlite.el
@@ -96,7 +96,11 @@ (cl-defmethod initialize-instance :after
                    "emacsql-sqlite" buffer emacsql-sqlite-executable fullfile)))
     (setf (slot-value connection 'process) process)
     (setf (process-sentinel process)
-          (lambda (proc _) (kill-buffer (process-buffer proc))))
+          (lambda (proc str)
+            (let ((buf (process-buffer proc)))
+              (message "--- %s" str)
+              (message ">>>%s<<<" (with-current-buffer buf (buffer-string)))
+              (kill-buffer buf))))
     (emacsql-wait connection)
     (emacsql connection [:pragma (= busy-timeout $s1)]
              (/ (* emacsql-global-timeout 1000) 2))

and post the output.

from emacsql.

tsdh avatar tsdh commented on September 27, 2024

Bug report on the emacs side: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60872

from emacsql.

tarsius avatar tarsius commented on September 27, 2024

Fixed. See magit/forge#535 (comment).

from emacsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.