ergoemacs / ergoemacs-mode

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

"ergoemacs-theme-component" not working after update #351

Closed gamaralf closed 9 years ago

gamaralf commented 9 years ago

The following code stopped working some days ago after I updated ergoemacs via package manager.

(ergoemacs-theme-component my-theme01 ()
  "My ergoemacs-mode theme component"
  (global-set-key (kbd "C-x 1") 'delete-other-windows)
  (global-set-key (kbd "C-x 2") 'split-window-vertically)
  (global-set-key (kbd "C-x 3") 'split-window-horizontally)
  ;; more code ... 
  (global-set-key '[f2] 'save-buffer)
)

(add-hook 'ergoemacs-mode
          (lambda ()
            (ergoemacs-require 'my-theme01)))

I use ergoemacs-theme-component to alter some keyboard shortcuts.

I get the warning: Symbol's value as variable is void: ergoemacs-theme-comp-hash. If I start emacs with --debug-init, I get thge error:

Debugger entered--Lisp error: (void-variable ergoemacs-theme-comp-hash)
mattfidler commented 9 years ago

What version of emacs are you using?

Also when do you require ergoemacs-mode?

mattfidler commented 9 years ago

If you can provide a very simple configuration, I can write a test to fix this issue and hopefully make sure it never reappears. Meanwhile you could downgrade to the latest stable.

gamaralf commented 9 years ago

From my "About Emacs (sorry I did not provide that information up front):

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07
on lamiak, modified by Debian

I noticed that the error void-variable ergoemacs-theme-comp-hash is triggered by the function call:

(ergoemacs-theme-component my-theme01 () 
...
mattfidler commented 9 years ago

This should be defined after ergoemacs-mode is loaded.

Anyhow, I have a fix that may avoid the error, but I'm unsure if the keys will be preserved unless they are after a statement like:

(require 'ergoemacs-mode)
mattfidler commented 9 years ago

The other thing to try is to delete all of the elc files and try again.

mattfidler commented 9 years ago

Also you may wish to use

(add-hook 'ergoemacs-mode-hook 
          (lambda ()
            (ergoemacs-require 'my-theme01)))
mattfidler commented 9 years ago

It works for me. It seems to pass this test as well.

magichowl commented 9 years ago

Error setting custom-enabled-themes: (error Variable binding depth exceeds max-specpdl-size)

mattfidler commented 9 years ago

Did you get a back-trace?

mattfidler commented 9 years ago

I'm not sure, but the infinite loop could have been fixed in 3bb776dac76a6f6c40b756f334f4287c27d54cce

magichowl commented 9 years ago

There is neither backtrace errors nor Message errors when I start with "--debug-init".

While I press "down-mouse-1", error appears

Wrong number of arguments: (lambda (rest) (interactive) (funcall (quote mouse-set-point) last-command-event)), 0 [7 times]
Mark set [4 times]

another other error is

string-match-p: Wrong type argument: stringp, nil
Error in post-command-hook (ergoemacs-map--modify-active): (wrong-type-argument stringp nil)
Mark set [3 times]
mattfidler commented 9 years ago

What version of emacs are you using. Outside of ergoemacs-mode, could you please let me know what the function (help-function-arglist 'mouse-set-point) returns. For me, I get (arg1). I'm curious what you get.

magichowl commented 9 years ago

after start, error in Messages is

Error in post-command-hook (ergoemacs-map--modify-active): (wrong-type-argument stringp nil)

Then I turn off ergoemacs-mode,

Ergoemacs mode disabled
string-match-p: Wrong type argument: stringp, nil

under emacs 24.4.1, (help-function-arglist 'mouse-set-point) returns (&rest rest)

mattfidler commented 9 years ago

Under Emacs 24.4.1 GNU Emacs 24.4.1 (i686-pc-mingw32) of 2014-10-24 on LEG570, I get (arg1). There must be system differences in how mouse behavior is treated on different platforms.

I also get (stringp nil) = nil; Do you get (wrong-type-argument stringp nil)? when you try to evaluate this?

mattfidler commented 9 years ago

I also saw a place where string-match-p could possibly cause this issue. When I try (string-match-p "a" nil), I get they (wrong-type-argument stringp nil), so possibly, 1ecc2f905d817e7a8df082278070d0e0b8e84b13 will fix the issue.

magichowl commented 9 years ago

My emacs version is GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.9) of 2015-03-21 on kissel, modified by Debian

Now down-mouse-1 emits

apply: Wrong number of arguments: #[(ad--addoit-function event) "Ä 
!Å=ƒ.Æ ˆ)‡" [ad-return-value ad--addoit-function event
major-mode nil calendar-mode calendar-update-mode-line] 2], 3
magichowl commented 9 years ago

I evaluated (help-function-arglist 'mouse-set-point) after starting emacs and disabling ergoemacs-mode return (&rest rest)

mattfidler commented 9 years ago

Can you check to see what function is changing down-mouse-1?

You can check by describe-function. It should show some advice.

mattfidler commented 9 years ago

When you use describe-function, can you click through to the code. I get:

(defun mouse-set-point (event)
  "Move point to the position clicked on with the mouse.
This should be bound to a mouse click event type."
  (interactive "e")
  (mouse-minibuffer-check event)
  ;; Use event-end in case called from mouse-drag-region.
  ;; If EVENT is a click, event-end and event-start give same value.
  (posn-set-point (event-end event)))

which doesn't reflect what you are getting from your mouse-set-point.

magichowl commented 9 years ago

<down-mouse-1> is a key (sorry if misunderstood you) , after I describe-key,

<down-mouse-1> at that spot runs the command mouse-drag-region, which
is an interactive compiled Lisp function.
...
<mouse-1> at that spot runs the command mouse-set-point, which is an
interactive compiled Lisp function.
It is bound to <triple-mouse-1>, <double-mouse-1>, <mouse-1>.

(mouse-set-point EVENT)

:around advice: `ad-Advice-mouse-set-point'
...
ad-Advice-mouse-set-point is a compiled Lisp function.

(ad-Advice-mouse-set-point AD--ADDOIT-FUNCTION EVENT)

After-advice `calendar-update-mode-line'.
mattfidler commented 9 years ago

You must have the following package:

https://github.com/loochao/lch-emacs-v3/blob/master/site-lisp/xwl-elisp/cal-china-x.el

Or something similar...

However, I think the latest commit should work with advices...?

mattfidler commented 9 years ago

I tried a similar advice with emacs 24.4 and had similar outputs that you had. I have no problems with my mouse with the latest commit.

magichowl commented 9 years ago

Thanks very much. my issue is solved.

mattfidler commented 9 years ago

Great. I will also assume it is solved for @gamaralf . For now, I'm closing the issue.