2

Yesterday I found desktop mode from EmacsWiki, and then I configure it for my Emacs 24:

;; Desktop
(require 'desktop)

;; save the desktop file automatically if it already exists
(desktop-save-mode 1)

;; use only one desktop
(setq desktop-path '("~/.emacs.d/tmp/"))
(setq desktop-dirname "~/.emacs.d/tmp/")
(setq desktop-base-file-name "desktop.cache")

But I got a warning in *Compile-Log* buffer when I restart Emacs:

Warning: ad-Orig-kill-region called with 3 arguments, but accepts only 2

Anyone else encounter this warning when use desktop? Or, any add-ons else better than desktop-mode?

Drew
  • 29,895
  • 7
  • 74
  • 104
hbin
  • 2,657
  • 1
  • 23
  • 23

1 Answers1

2

The ad-Orig- prefix is telling you that the function kill-region is advised. Possibly that advice is causing issues?

C-hf kill-region RET should tell you the name of the advice; chances are good that it's something in your own config, so I would look for it there firstly.

See if disabling the advice resolves the problem.

I do note an oddity with this function in Emacs 24; the source code for kill-region clearly takes an optional third argument, but that *Help* screen mentions only the two required args.

I checked in Emacs 23, and the help there mentions all three arguments.

Perhaps there's a bug in Emacs 24 which is responsible for both the discrepancy in the help output, and the error you're seeing?

phils
  • 71,335
  • 11
  • 153
  • 198
  • You are right, It seems to be a bug in Emacs 24. I copy a desktop session file and then restart Emacs, Emacs24 log the warning while the Emacs23 doesn't. But I haven't find the advise to be disabling. – hbin May 01 '12 at 06:51
  • I have the same behavior with ErgoEmacs keybinding package, which includes "before-advice slick-copy" with kill-region. – Mirzhan Irkegulov May 01 '12 at 07:03
  • 1
    Evaluate `(ad-deactivate 'kill-region)` (checking `C-h f kill-region RET` should confirm it is no longer advised), and then see if the error persists. – phils May 01 '12 at 07:17
  • Great!! No warning any more, Thank you very much. – hbin May 02 '12 at 05:12
  • You're welcome, but do note that deactivating the advice should only be considered a temporary workaround, and you should follow it up further. Either the library defining that advice needs to be updated to be compatible with Emacs 24, or there really is a bug in Emacs itself. You should probably start by contacting the library author. You can report Emacs bugs with `M-x report-emacs-bug`. – phils May 02 '12 at 09:48