ergoemacs / ergoemacs-mode

ergoemacs-mode
ergoemacs.github.io/
GNU General Public License v3.0
293 stars 35 forks source link

Icicles q in calc freezes emacs #413

Closed sg2002 closed 8 years ago

sg2002 commented 8 years ago

Starting from clean ergomeacs+icicles config do M-a calc.

Then, whenever you try exiting calc with q, it's going to freeze emacs.

mattfidler commented 8 years ago

I can reproduce this, but cannot figure out why.

mattfidler commented 8 years ago

By replacing calc-quit with

(defun calc-quit (&optional non-fatal interactive)
       "Quit the Calculator in an appropriate manner."
       (interactive "i\np")
       (message "calc-quit 1")
       (and calc-standalone-flag (not non-fatal)
        (save-buffers-kill-emacs nil))
       (message "calc-quit 2")
       (if (and (equal (buffer-name) "*Gnuplot Trail*")
        (> (recursion-depth) 0))
       (exit-recursive-edit))
       (message "calc-quit 3")
       (if (derived-mode-p 'calc-edit-mode)
       (progn (calc-edit-cancel)
          (message "calc-quit 4"))
     (if (and interactive
          calc-embedded-info
          (eq (current-buffer) (aref calc-embedded-info 0)))
         (progn
           (calc-embedded nil)
           (message "calc-quit 5"))
       (unless (derived-mode-p 'calc-mode)
         (message "calc-quit 6")
         (calc-create-buffer))
       (message "calc-quit 7")
       (run-hooks 'calc-end-hook)
       (message "calc-quit 8")
       (if (integerp calc-undo-length)
           (cond
        ((= calc-undo-length 0)
         (message "calc-quit 9")
         (setq calc-undo-list nil calc-redo-list nil))
        ((> calc-undo-length 0)
         (message "calc-quit 10")
         (let ((tail (nthcdr (1- calc-undo-length) calc-undo-list)))
           (if tail (setcdr tail nil)))
         (setq calc-redo-list nil))))
       (message "calc-quit 11")
       (mapc (function (lambda (v) (set-default v (symbol-value v))))
         calc-local-var-list)
       (message "calc-quit 12")
       (let ((buf (current-buffer))
         (win (get-buffer-window (current-buffer)))
         (kbuf (get-buffer "*Calc Keypad*")))
         (message "calc-quit 13")
         (delete-windows-on (calc-trail-buffer))
         ;; The next few lines will set `calc-window-height' so that the
         ;; next time Calc is called, the window will be the same size
         ;; as the current window.
         (message "calc-quit 14")
         (if (and win
              (not (window-full-height-p win))
              (window-full-width-p win) ; avoid calc-keypad
              (not (get-buffer-window "*Calc Keypad*")))
         (progn (message "calc-quit 15")
            (setq calc-window-height (- (window-height win) 2))))
         (progn
           (message "calc-quit 16")
           (delete-windows-on buf)
           (and kbuf (delete-windows-on kbuf)))
         (message "calc-quit 17")
         (bury-buffer buf)
         (bury-buffer calc-trail-buffer)
         (and kbuf (bury-buffer kbuf))
         (message "calc-quit 18")))))

I see the message "calc-quit-18", so the issue is not with calc-quit....

mattfidler commented 8 years ago

I fixed the issue.