From: npostavs@users.sourceforge.net
To: Ian Perryman <iperryman@xtreme-eda.com>
Cc: Paul Eggert <eggert@cs.ucla.edu>, 23842@debbugs.gnu.org
Subject: bug#23842: 24.4; Runaway background process
Date: Sat, 13 Aug 2016 22:36:53 -0400 [thread overview]
Message-ID: <874m6ovzy2.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CANoMOPf+L=af-g3s1WrRuBWNYOdm-wWt49SEGLnoChT5qTrw2Q@mail.gmail.com> (Ian Perryman's message of "Mon, 27 Jun 2016 09:51:47 -0400")
[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]
tags 23842 patch
quit
Ian Perryman <iperryman@xtreme-eda.com> writes:
> I am not the author of the verilog mode. I have alerted the maintainer
> to the issue at
> http://www.veripool.org/issues/1070-Verilog-mode-Auto-completion-results-in-runaway-emacs-process-in-emacs-24-4-on-Debian-using-2016-04-23-5f6855e-vpo
>
> Not sure what the intended behaviour is. My guess is that the list of
> possible completions was to be presented in the temporary buffer, and
> then user could select the completion they wanted with a mouse click
> and it should be inserted back in the original buffer.
>
> Did the definition of with-output-to-temp-buffer change over the
> years? I am not certain when this code was developed, but it was quite
> a while back. I am surprised that no one else has complained about it.
Probably most Emacs users don't use the mouse much.
>
> Perhaps the paradigm for completion is not being followed by this mode?
>
> Any suggestions?
I can't really figure out how that completion window code is supposed to
work, but it seems to be duplicating completion-at-point functionality.
Patch below just replaces most of it with completion-at-point and it
seems to work fine. But I see at the top of the file
;; This code supports Emacs 21.1 and later
;; And XEmacs 21.1 and later
;; Please do not make changes that break Emacs 21. Thanks!
So it may need some adjustments for Emacs 21...
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 7766 bytes --]
From ed885f166108945b8e99d09feaac53ee470a3f2c Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 13 Aug 2016 22:13:56 -0400
Subject: [PATCH v1] Use completion-at-point in verilog-mode
There were some functions in verilog-mode that implemented in-buffer
completion, but this needlessly duplicates completion-at-point
functionality, and the popup window management had problems
(see Bug #23842).
* lisp/progmodes/verilog-mode.el (verilog-toggle-completions): Mark
obsolete, it does the same job as `completion-cycle-threshold'.
(verilog-completion-at-point): New function.
(verilog-show-completions): Remove, replace calls with
`completion-help-at-point'.
(verilog-complete-word): Remove, replace calls with `completion-at-point'.
---
lisp/progmodes/verilog-mode.el | 109 +++++++++--------------------------------
1 file changed, 23 insertions(+), 86 deletions(-)
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index fd2e96a..e5b9ee8 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -1374,8 +1374,8 @@ verilog-mode-map
(define-key map "\M-\C-b" 'electric-verilog-backward-sexp)
(define-key map "\M-\C-f" 'electric-verilog-forward-sexp)
(define-key map "\M-\r" `electric-verilog-terminate-and-indent)
- (define-key map "\M-\t" 'verilog-complete-word)
- (define-key map "\M-?" 'verilog-show-completions)
+ (define-key map "\M-\t" 'completion-at-point)
+ (define-key map "\M-?" 'completion-help-at-point)
;; Note \C-c and letter are reserved for users
(define-key map "\C-c`" 'verilog-lint-off)
(define-key map "\C-c*" 'verilog-delete-auto-star-implicit)
@@ -1498,7 +1498,7 @@ verilog-mode-map
:help "Take a signal vector on the current line and expand it to multiple lines"]
["Insert begin-end block" verilog-insert-block
:help "Insert begin ... end"]
- ["Complete word" verilog-complete-word
+ ["Complete word" completion-at-point
:help "Complete word at point"]
"----"
["Recompute AUTOs" verilog-auto
@@ -3762,7 +3762,7 @@ verilog-mode
Some other functions are:
- \\[verilog-complete-word] Complete word with appropriate possibilities.
+ \\[completion-at-point] Complete word with appropriate possibilities.
\\[verilog-mark-defun] Mark function.
\\[verilog-beg-of-defun] Move to beginning of current function.
\\[verilog-end-of-defun] Move to end of current function.
@@ -3876,6 +3876,9 @@ verilog-mode
verilog-forward-sexp-function)
hs-special-modes-alist))))
+ (add-hook 'completion-at-point-functions
+ #'verilog-completion-at-point nil 'local)
+
;; Stuff for autos
(add-hook 'write-contents-hooks 'verilog-auto-save-check nil 'local)
;; verilog-mode-hook call added by define-derived-mode
@@ -7143,10 +7146,9 @@ verilog-pred
(defvar verilog-buffer-to-use nil)
(defvar verilog-flag nil)
(defvar verilog-toggle-completions nil
- "True means \\<verilog-mode-map>\\[verilog-complete-word] should try all possible completions one by one.
-Repeated use of \\[verilog-complete-word] will show you all of them.
-Normally, when there is more than one possible completion,
-it displays a list of all possible completions.")
+ "Obsolete, use `completion-cycle-threshold' instead.")
+(make-obsolete-variable
+ 'verilog-toggle-completions 'completion-cycle-threshold "25.2")
(defvar verilog-type-keywords
@@ -7429,85 +7431,20 @@ verilog-last-word-numb
(defvar verilog-last-word-shown nil)
(defvar verilog-last-completions nil)
-(defun verilog-complete-word ()
- "Complete word at current point.
-\(See also `verilog-toggle-completions', `verilog-type-keywords',
-and `verilog-separator-keywords'.)"
- ;; FIXME: Provide completion-at-point-function.
- (interactive)
- (let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point)))
- (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point)))
- (verilog-str (buffer-substring b e))
- ;; The following variable is used in verilog-completion
- (verilog-buffer-to-use (current-buffer))
- (allcomp (if (and verilog-toggle-completions
- (string= verilog-last-word-shown verilog-str))
- verilog-last-completions
- (all-completions verilog-str 'verilog-completion)))
- (match (if verilog-toggle-completions
- "" (try-completion
- verilog-str (mapcar (lambda (elm)
- (cons elm 0)) allcomp)))))
- ;; Delete old string
- (delete-region b e)
-
- ;; Toggle-completions inserts whole labels
- (if verilog-toggle-completions
- (progn
- ;; Update entry number in list
- (setq verilog-last-completions allcomp
- verilog-last-word-numb
- (if (>= verilog-last-word-numb (1- (length allcomp)))
- 0
- (1+ verilog-last-word-numb)))
- (setq verilog-last-word-shown (elt allcomp verilog-last-word-numb))
- ;; Display next match or same string if no match was found
- (if (not (null allcomp))
- (insert "" verilog-last-word-shown)
- (insert "" verilog-str)
- (message "(No match)")))
- ;; The other form of completion does not necessarily do that.
-
- ;; Insert match if found, or the original string if no match
- (if (or (null match) (equal match 't))
- (progn (insert "" verilog-str)
- (message "(No match)"))
- (insert "" match))
- ;; Give message about current status of completion
- (cond ((equal match 't)
- (if (not (null (cdr allcomp)))
- (message "(Complete but not unique)")
- (message "(Sole completion)")))
- ;; Display buffer if the current completion didn't help
- ;; on completing the label.
- ((and (not (null (cdr allcomp))) (= (length verilog-str)
- (length match)))
- (with-output-to-temp-buffer "*Completions*"
- (display-completion-list allcomp))
- ;; Wait for a key press. Then delete *Completion* window
- (momentary-string-display "" (point))
- (delete-window (get-buffer-window (get-buffer "*Completions*")))
- )))))
-
-(defun verilog-show-completions ()
- "Show all possible completions at current point."
- (interactive)
+(defun verilog-completion-at-point ()
+ "Used as an element of `completion-at-point-functions'.
+\(See also `verilog-type-keywords' and
+`verilog-separator-keywords'.)"
(let* ((b (save-excursion (skip-chars-backward "a-zA-Z0-9_") (point)))
- (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point)))
- (verilog-str (buffer-substring b e))
- ;; The following variable is used in verilog-completion
- (verilog-buffer-to-use (current-buffer))
- (allcomp (if (and verilog-toggle-completions
- (string= verilog-last-word-shown verilog-str))
- verilog-last-completions
- (all-completions verilog-str 'verilog-completion))))
- ;; Show possible completions in a temporary buffer.
- (with-output-to-temp-buffer "*Completions*"
- (display-completion-list allcomp))
- ;; Wait for a key press. Then delete *Completion* window
- (momentary-string-display "" (point))
- (delete-window (get-buffer-window (get-buffer "*Completions*")))))
-
+ (e (save-excursion (skip-chars-forward "a-zA-Z0-9_") (point)))
+ (verilog-str (buffer-substring b e))
+ ;; The following variable is used in verilog-completion
+ (verilog-buffer-to-use (current-buffer))
+ (allcomp (if (and verilog-toggle-completions
+ (string= verilog-last-word-shown verilog-str))
+ verilog-last-completions
+ (all-completions verilog-str 'verilog-completion))))
+ (list b e allcomp)))
(defun verilog-get-default-symbol ()
"Return symbol around current point as a string."
--
2.9.2
next prev parent reply other threads:[~2016-08-14 2:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 19:08 bug#23842: 24.4; Runaway background process Ian Perryman
2016-06-24 20:02 ` bug#23842: Dribble files Ian Perryman
2016-06-25 7:00 ` Eli Zaretskii
2016-06-26 0:55 ` Ian Perryman
2016-06-25 6:50 ` bug#23842: 24.4; Runaway background process Eli Zaretskii
2016-06-25 20:49 ` Noam Postavsky
2016-06-26 2:37 ` Eli Zaretskii
2016-06-26 8:51 ` Paul Eggert
2016-06-26 17:04 ` Glenn Morris
2016-06-26 19:02 ` Ian Perryman
2016-06-26 19:50 ` Paul Eggert
2016-06-27 12:46 ` Ian Perryman
2016-06-27 13:24 ` Ken Brown
2016-06-27 13:51 ` Ian Perryman
2016-08-14 2:36 ` npostavs [this message]
2016-12-20 3:58 ` npostavs
2016-06-27 15:49 ` Eli Zaretskii
2016-06-27 16:54 ` Ken Brown
2016-06-26 19:48 ` Paul Eggert
2016-12-21 23:37 ` Wilson Snyder
2016-12-22 2:44 ` npostavs
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874m6ovzy2.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=23842@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=iperryman@xtreme-eda.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.