ergoemacs / ergoemacs-mode

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

Freezing when Killing buffers... #407

Closed mattfidler closed 8 years ago

mattfidler commented 8 years ago

Found another small, but pretty baffling issue that happens when you have icicles and ergoemacs together. I have this function in my init that i use sometimes:

(defun delete-this-buffer-and-file ()
  "Removes file connected to current buffer and kills buffer."
  (interactive)
  (let ((filename (buffer-file-name))
        (buffer (current-buffer))
        (name (buffer-name)))
    (if (not (and filename (file-exists-p filename)))
        (error "Buffer '%s' is not visiting a file!" name)
      (when (yes-or-no-p "Are you sure you want to remove this file? ")
        (delete-file filename)
        (kill-buffer buffer)
        (message "File '%s' successfully removed" filename)))))

With ergoemacs+icicles this freezes emacs to death.

See Issue #372 @sg2002

mattfidler commented 8 years ago

This command works with ergoemacs-mode alone.

mattfidler commented 8 years ago

This command also works with icy-mode alone.

mattfidler commented 8 years ago

I enabled icy-mode and ergoemacs-mode and this command still works... I cannot reproduce this bug.

mattfidler commented 8 years ago

You could try

(defun delete-this-buffer-and-file ()
  "Removes file connected to current buffer and kills buffer."
  (interactive)
  (let ((filename (buffer-file-name))
        (buffer (current-buffer))
        (name (buffer-name)))
    (if (not (and filename (file-exists-p filename)))
        (error "Buffer '%s' is not visiting a file!" name)
      (when (yes-or-no-p "Are you sure you want to remove this file? ")
        (kill-buffer buffer)
        (delete-file filename)
        (message "File '%s' successfully removed" filename)))))

It makes no sense to me to delete the file until after the buffer is killed.

sg2002 commented 8 years ago

Happens for me with a basic config:

(require 'ergoemacs-mode)
(ergoemacs-mode 1)
(require 'icicles)
(icy-mode 1)
(defun test-freeze ()
  (interactive)
  (yes-or-no-p "Are you sure you want to remove this file? "))

Freeze happens only when both icicles and ergoemacs are enabled. Also it happens only when the function is called interactively.

Since you're probably using 25 beta, decided to test with it too, yep still happens with a recent nightly. Also tried 24.5 w64.

Normally I'm using official 24.5 32bit on windows.

mattfidler commented 8 years ago

I use 24.5 windows 32. I didn't have any issues yesterday.

On Wed, Mar 16, 2016, 12:51 PM sg2002 notifications@github.com wrote:

Happens for me with a basic config:

(require 'ergoemacs-mode) (ergoemacs-mode 1) (require 'icicles) (icy-mode 1) (defun test-freeze () (interactive) (yes-or-no-p "Are you sure you want to remove this file? "))

Freeze happens only when both icicles and ergoemacs are enabled. Also it happens only when the function is called interactively.

Since you're probably using 25 beta, decided to test with it too, yep still happens with a recent nightly. Also tried 24.5 w64.

Normally I'm using official 24.5 32bit on windows.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/ergoemacs/ergoemacs-mode/issues/407#issuecomment-197456796

mattfidler commented 8 years ago

I didn't call the function interactivly....

mattfidler commented 8 years ago

I called the function interactively in a basic evironment and cannot reproduce your error.

My environment can be duplicated by:

(require 'ergoemacs-mode)
(require 'ergoemacs-test)
(ergoemacs-mode 1)

Then interactivly calling ergoemacs-test-require-input. From there you can test the interactive call by C-1.

The code that is run is:

(add-to-list 'load-path "ergoemacs-mode")
(add-to-list 'load-path "icicles")
(eval-when-compile (require 'ergoemacs-macros) (require 'cl))
(setq ergoemacs-theme nil)
(setq ergoemacs-keyboard-layout "us")
(require 'ergoemacs-mode)
(ergoemacs-mode 1)
(require 'icicles)
(icy-mode 1)
(defun test-freeze ()
  (interactive)
  (yes-or-no-p "Are you sure you want to remove this file? "))
(global-set-key (kbd "C-1") 'test-freeze)
(insert "Try C-1 to see if emacs freezes.")
mattfidler commented 8 years ago

I run emacs -debug-init -Q -l compiled-file

sg2002 commented 8 years ago

C-1 works, but if I do M-a test-freeze from within the unit test emacs, the freeze happens.

mattfidler commented 8 years ago

I reproduced the behavior. It only occurs when calling from icicles M-a.

Please make sure this works for you.