senny / cabbage

get the maximum out of emacs
http://senny.github.com/cabbage/
156 stars 21 forks source link

text replacement after selection #114

Closed bjoernbur closed 12 years ago

bjoernbur commented 12 years ago

When I select any text in any file and hit a key, the selected text should be replaced with the entered value.

senny commented 12 years ago

@jone this is the same bug we had when using fred-o's autopair branch. @bjoernbur is using the latest master version though. thoughts?

jone commented 12 years ago

I only experienced this on the autopair branch. Is it the same problem, that the delete-selection-pre-hook disappears? After emacs restart it works again?

Please dump pre-command-hook (M-: -> pre-command-hook) after emacs start (when it works, I assume) and when the bug occurs.

We need to debug this further and try to find out what is conflicting. Did you see any pattern, like that it bugs after using a mode or a function or doing something specific? This would be very helpful.

If it is the exact same problem, a M-: (add-hook 'pre-command-hook 'delete-selection-pre-hook) will fix the session so that you can continue your work.

senny commented 12 years ago

I guess it's the same issue... again disabling and enabling delete-selection-mode gets it working again.

jone commented 12 years ago

hmm...

Which bundles are active? Please dump (e-max-list-bundles). When did you update e-max the last time? Which was the last working commit (see git reflog)?

@senny could it be possible that we have the problem because we updated a vendor?

jone commented 12 years ago

@bjoernbur could you put the following advice in your ~/.emacs.d/local.el or eval it in a scratch buffer?

(defadvice remove-hook (before debug-selection-hook (hook function &optional local))
  (if (and (eq hook 'pre-command-hook)
           (eq function 'delete-selection-pre-hook))
      (raise "Removing delete-selection-pre-hook")))

(ad-activate 'remove-hook)
;; (ad-deactivate 'remove-hook)

This patches the remove-hook function so that it raises an exception as soon as the delete-selection-pre-hook is removed, which causes your bug. It will open a new buffer with a traceback. Could you paste that traceback here? This will help us debug the problem.

This is just a temporary debugging advice. You can disable the advice with ad-deactivate (as in the code snippet) or by removing it from your config and restart emacs.

senny commented 12 years ago

@bjoernbur I also added a basic debugging function. Please upgrade to the latest version of e-max cd ~/.e-max/ && ./scripts/update.sh. Once the bug appears press: M-x e-max-debug and post the resulting buffer to the ticket.

senny commented 12 years ago

@bjoernbur we can't reproduce this bug. I'm closing the issue for now. If you still experience the same problem please add a comment.