emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understanding the cause of a bug causing *all* bindings to be wiped


From: Kaushal Modi
Subject: Re: Understanding the cause of a bug causing *all* bindings to be wiped out
Date: Mon, 11 Jul 2016 19:57:58 +0000

I am getting some hard to debug/fix conclusions for this issue.

Looks like 2 issues are overlapping in my config; not necessarily config but due to the packages I am installing: (1) the help-function-arglist error and (2) emacs freezing error.

(1) Narrowed down one of the issues: "help-function-arglist: End of file during parsing"

This is caused by just enabling global-projectile-mode (projectile package) followed by evaluating (string-match-p "." nil)

This part at least is easily reproducible by evaluating the below in an emacs -Q session (tested on master build).

=====
(progn
  (require 'package)
  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
  (package-initialize)
  (package-refresh-contents)
  (package-install 'projectile)

  (require 'projectile)
  (projectile-global-mode)
  (string-match-p "." nil))
=====

Here's the odd part .. If I replace string-match-p with string-match in the above progn block, I do *not* get this error:

Entering debugger...
help-function-arglist: End of file during parsing

Also if I disable projectile-global-mode, I do not get this error.

Another odd element to this issue is that even after M-x toggle-debug-on-error, above error does not result in a backtrace.

If it's of any help, projectile only advises delete-file and compilation-find-file.

So I cannot figure out what connects the string-match-p error, help-function-arglist error and global-projectile-mode; and why isn't this help-function-arglist error popping up when using string-match instead of string-match-p?

(2a) The another issue was emacs freezing up when I evaluated (string-match-p "." nil). For now, I can prevent that if I do not load the fci package ( http://www.emacswiki.org/FillColumnIndicator ). I yet have to derive a minimum working code to recreate that freeze on emacs -Q.

(2b) Another cause of emacs freeze was calling of define-key forms when enabling a minor mode (drag-stuff-minor-mode from the drag-stuff package). I need to create a minimum working version to prove this "fix" too.

For some reason, the drag-stuff package calls a function that sets the drag-stuff-mode-map key definitions when that minor mode is enabled.

Here's the code from the package:

=====
(defun drag-stuff-define-keys ()
  "Defines keys for `drag-stuff-mode'."
  (define-key drag-stuff-mode-map (drag-stuff--kbd 'up) 'drag-stuff-up)
  (define-key drag-stuff-mode-map (drag-stuff--kbd 'down) 'drag-stuff-down)
  (define-key drag-stuff-mode-map (drag-stuff--kbd 'right) 'drag-stuff-right)
  (define-key drag-stuff-mode-map (drag-stuff--kbd 'left) 'drag-stuff-left))

;;;###autoload
(define-minor-mode drag-stuff-mode
  "Drag stuff around."
  :init-value nil
  :lighter " drag"
  :keymap drag-stuff-mode-map
  (when drag-stuff-mode
    (drag-stuff-define-keys)))
=====

The "fix" was simply to do the key binding outside the minor mode.

=====
    ;; Mon Jul 11 14:09:57 EDT 2016 - kmodi
    ;; Earlier I had the below `bind-keys' form inside `drag-stuff-define-keys'
    ;; function. Strangely, with that, evaluation of "(string-match-p "." nil)"
    ;; made emacs freeze. But moving it out does not! I got the same emacs freeze
    ;; issue if I replaced `bind-keys' with `define-key' forms *inside* that
    ;; `drag-stuff-define-keys' function.
    ;; https://lists.gnu.org/archive/html/emacs-devel/2016-07/msg00519.html
    (bind-keys
     :map drag-stuff-mode-map
      ("C-M-p" . drag-stuff-up)
      ("C-M-n" . drag-stuff-down)
      ("C-M-;" . drag-stuff-left)
      ("C-M-'" . drag-stuff-right))

    (defun drag-stuff-define-keys () nil)
=====

By doing above *and* not loading fci package, I was able to prevent emacs from freezing on evaluating (string-match-p "." nil)... No idea why.

(4) Finally I hope one or all of the above had anything to do the bindings wipeout issue (which I still haven't been able to recreate ever since I started this thread).
--

--
Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]