From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: Understanding the cause of a bug causing *all* bindings to be wiped out Date: Mon, 11 Jul 2016 19:57:58 +0000 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113e3ac246841a053761928b X-Trace: ger.gmane.org 1468267110 12074 80.91.229.3 (11 Jul 2016 19:58:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Jul 2016 19:58:30 +0000 (UTC) Cc: Emacs developers To: Stefan Monnier , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 11 21:58:22 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bMhLS-0008TY-El for ged-emacs-devel@m.gmane.org; Mon, 11 Jul 2016 21:58:22 +0200 Original-Received: from localhost ([::1]:35837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMhLR-0002uu-H1 for ged-emacs-devel@m.gmane.org; Mon, 11 Jul 2016 15:58:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMhLL-0002un-25 for emacs-devel@gnu.org; Mon, 11 Jul 2016 15:58:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMhLI-0005Do-6z for emacs-devel@gnu.org; Mon, 11 Jul 2016 15:58:13 -0400 Original-Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:33028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMhLF-0005DK-Nq; Mon, 11 Jul 2016 15:58:09 -0400 Original-Received: by mail-oi0-x22b.google.com with SMTP id u201so163409422oie.0; Mon, 11 Jul 2016 12:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=adTPjRn4ianVRmpdosblxWZqZvxS+S05dAJ+UaUbz5Q=; b=FtcStxlG30EXLYtMBZuYMP2DqK+iULVKE1iOl+PVRKOO3ppVla1BV7jydr3ltnS/UW jdrUQF0x1DnJ+nPILci6bueFhLYLNYmRjWYe6xQimfMnpFG2wUioszBw4RCmO8Z6DFy3 2qNVTDd2CIQ1WwygV5/bORPRcMo/LbzP5HUPWSrTM24oxr8pluHHUCPju7nVs9bNke/B mf1CGoxd9kAwmXf/bA8lUUHxyIruxVc0xa6Ce/A8gOzkCC/hL33HOri3hFZiaWa3HFIS MDYs/v1GkJlWfDAqQQKCcqthVnue04WzzCl2uenD0CtP4nKoAtMN6gRehRMXiEFItoet 29pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=adTPjRn4ianVRmpdosblxWZqZvxS+S05dAJ+UaUbz5Q=; b=jY5CKfI1U4TgUKcxZkYfB2gR01adkuL7/YuBuXDR6jV/Dup83LBYYqxkoxqnnKIltn 6qq1AfbawtC3c0cb1MrXcZfsk9EfCdc1tcffLoC6Cix+4nJbA0qpuj9bGGDAIkMSgbeC 1UEM1UGl+Im2jRitN+ua2HKbxF3HwtU6IuUW+miBsnkTBdIvvoHYHLUMnD2RYKS3+G01 +CYww6od8rvy7JaodVl3lNPD+awi3X4X5y/88R6wVd7xg7kmdfT4mORKgG/9VghaKY/q OZueY85pHGZf0hns5NCY5Vc7kx4zeAZkzOSF7O/Q9sn0PMqF9GzItVMRXL3eQ2gCCNel 1KOg== X-Gm-Message-State: ALyK8tLH30n0uRLUt0zXfq8kgsPciFER9Q0RWLLYqBLgfb6PKAU9hewuLPXXoVa/fzJc4DwE3ssD9unya89myA== X-Received: by 10.157.5.198 with SMTP id 64mr11881193otd.60.1468267089001; Mon, 11 Jul 2016 12:58:09 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205560 Archived-At: --001a113e3ac246841a053761928b Content-Type: text/plain; charset=UTF-8 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 --001a113e3ac246841a053761928b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I am getting some hard to debug/fix conclusions for this i= ssue.

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

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

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

This part at least is easily reproducible by evaluati= ng the below in an emacs -Q session (tested on master build).
=3D=3D=3D=3D=3D
(progn
=C2=A0 (require= 'package)
=C2=A0 (add-to-list 'package-archives '(&q= uot;melpa" . "http://melpa= .org/packages/") t)
=C2=A0 (package-initialize)
=C2=A0 (package-refresh-contents)
=C2=A0 (package-install '= projectile)

=C2=A0 (require 'projectile)
=
=C2=A0 (projectile-global-mode)
=C2=A0 (string-match-p "= ;." nil))
=3D=3D=3D=3D=3D

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

En= tering debugger...
help-function-arglist: End of file during pars= ing

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

Another odd element to th= is 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, p= rojectile only advises delete-file and compilation-find-file.
So I cannot figure out what con= nects the string-match-p error, help-function-arglist error and global-proj= ectile-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=C2=A0(string-match-p "." nil). For= now, I can prevent that if I do not load the fci package (=C2=A0http://www.emacswiki.= org/FillColumnIndicator=C2=A0). I yet h= ave to derive a minimum working code to recreate that freeze on emacs -Q.

(2b) Another cause of emacs freeze was calling o= f define-key forms when enabling a minor mode (drag-stuff-minor-mode from t= he 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:

=3D=3D=3D= =3D=3D
(defun drag-stuff-define-keys ()
=C2= =A0 "Defines keys for `drag-stuff-mode'."
=C2=A0 (d= efine-key drag-stuff-mode-map (drag-stuff--kbd 'up) 'drag-stuff-up)=
=C2=A0 (define-key drag-stuff-mode-map (drag-stuff--kbd 'dow= n) 'drag-stuff-down)
=C2=A0 (define-key drag-stuff-mode-map (= drag-stuff--kbd 'right) 'drag-stuff-right)
=C2=A0 (define= -key drag-stuff-mode-map (drag-stuff--kbd 'left) 'drag-stuff-left))=

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

The "fix" was simply to do the key bindi= ng outside the minor mode.

=3D=3D=3D=3D=3D
=C2=A0 =C2=A0 ;; Mon Jul 11 14:09:57 EDT 2016 - kmodi
=C2=A0 =C2=A0 ;; Earlier I had the below `bind-keys' form inside= `drag-stuff-define-keys'
=C2=A0 =C2=A0 ;; function. Strangel= y, with that, evaluation of "(string-match-p "." nil)"<= /div>
=C2=A0 =C2=A0 ;; made emacs freeze. But moving it out does not! I= got the same emacs freeze
=C2=A0 =C2=A0 ;; issue if I replaced `= bind-keys' with `define-key' forms *inside* that
=C2=A0 = =C2=A0 ;; `drag-stuff-define-keys' function.
=C2=A0 =C2=A0 (bind-keys
=C2=A0 =C2=A0 =C2=A0:map = drag-stuff-mode-map
=C2=A0 =C2=A0 =C2=A0 ("C-M-p" . dra= g-stuff-up)
=C2=A0 =C2=A0 =C2=A0 ("C-M-n" . drag-stuff-= down)
=C2=A0 =C2=A0 =C2=A0 ("C-M-;" . drag-stuff-left)<= /div>
=C2=A0 =C2=A0 =C2=A0 ("C-M-'" . drag-stuff-right))<= /div>

=C2=A0 =C2=A0 (defun drag-stuff-define-keys () nil= )
=3D=3D=3D=3D=3D

By doing above *= and* not loading fci package, I was able to prevent emacs from freezing on = evaluating=C2=A0(string-match-p ".&quo= t; 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).
-- <= br>

--
Kaushal Modi

--001a113e3ac246841a053761928b--