GNU bug report logs - #17529
24.3; Error in hippie-expand

Previous Next

Package: emacs;

Reported by: Torbjørn Lindahl <torbjorn.lindahl <at> gmail.com>

Date: Mon, 19 May 2014 16:22:02 UTC

Severity: normal

Found in version 24.3

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Torbjørn Lindahl <torbjorn.lindahl <at> gmail.com>, 17529 <at> debbugs.gnu.org
Subject: bug#17529: 24.3; Error in hippie-expand
Date: Mon, 19 May 2014 23:01:10 +0200
Glenn Morris <rgm <at> gnu.org> writes:
> Can you do:
> M-x toggle-debug-no-error
> repeat the problem, and send the backtrace?

More details should come soon from the OP, but we managed to debug this
over IRC so I post the outcome :

First here's the backtrace :

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  buffer-substring-no-properties(nil 9745)
  he-init-string(nil 9745)
  try-expand-line(nil)
  apply(try-expand-line nil)
  hippie-expand(nil)
  call-interactively(hippie-expand record nil)
  command-execute(hippie-expand record)
  execute-extended-command(nil "hippie-expand")
  call-interactively(execute-extended-command nil nil)

This means that (he-line-beg strip-prompt) (that is called within
try-expand-line) returned nil. The reason is that it tries to collect
the 2nd group of a regexp that is not fully under control, namely
comint-prompt-regexp. In ESS, that regexp contains grouping constructs.

To avoid the problem, one solution is to replace "2" by "the last
group". The following patch thus fixes the problem for me... but (1- (/
(length (match-data)) 2)) is a bit cryptic.

--- /usr/local/share/emacs/24.3.91/lisp/hippie-exp.el.gz
+++ #<buffer hippie-exp.el.gz>
@@ -710,7 +710,7 @@
   (save-excursion
     (if (re-search-backward (he-line-search-regexp "" strip-prompt)
 			    (line-beginning-position) t)
-	(match-beginning 2)
+	(match-beginning (1- (/ (length (match-data)) 2)))
       (point))))
 
 (defun he-line-search-regexp (pat strip-prompt)

-- 
Nico.




This bug report was last modified 11 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.