unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, Eli Zaretskii <eliz@gnu.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Understanding the cause of a bug causing *all* bindings to be wiped out
Date: Mon, 11 Jul 2016 19:57:58 +0000	[thread overview]
Message-ID: <CAFyQvY37snkxMHFH6ZxVDr24-g64N6naofdkQY5MvyPtoA8hqg@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY3PpPzQ+mPRnR3CtkmZoWp_UC+EAXdYeA7XqttbmYO8Nw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3941 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 6351 bytes --]

  reply	other threads:[~2016-07-11 19:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11  5:28 Understanding the cause of a bug causing *all* bindings to be wiped out Kaushal Modi
2016-07-11  7:29 ` Andreas Schwab
2016-07-11 12:33   ` Stefan Monnier
2016-07-11 14:00     ` Kaushal Modi
2016-07-11 14:10       ` Stefan Monnier
2016-07-11 15:52         ` Kaushal Modi
2016-07-11 19:57           ` Kaushal Modi [this message]
2016-07-11 14:42     ` Eli Zaretskii
2016-07-11 15:20       ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY37snkxMHFH6ZxVDr24-g64N6naofdkQY5MvyPtoA8hqg@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).