unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [sdl.web@gmail.com: Re: For after-the-release: enhanced partial completion]
@ 2007-06-05 19:17 Richard Stallman
  2007-07-16 21:04 ` Sean O'Rourke
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2007-06-05 19:17 UTC (permalink / raw)
  To: emacs-devel

Would someone please DTRT thenack?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY 
	autolearn=failed version=3.1.0
From: Leo <sdl.web@gmail.com>
To: "Sean O'Rourke" <sorourke@cs.ucsd.edu>
Date: Tue, 05 Jun 2007 11:39:37 +0100
In-Reply-To: <m2hcpnz7iq.fsf@cs.ucsd.edu> (Sean O'Rourke's message of "Mon, 04
	Jun 2007 15:20:29 -0700")
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: emacs-devel@gnu.org
Subject: Re: For after-the-release: enhanced partial completion

Dear Sean,

- ----- Sean O'Rourke (2007-06-04) wrote:-----

> Here's a diff with "-w", which better shows the intent.
>
> /s

Just spotted a bug.

Problem:
  
  PC-lisp-complete-symbol fails in `eval-expression'.

Reproduce:
   1.  emacs -Q
   2.  M-x partial-completion-mode
   3.  M-: and then type in minibuffer `(emacs)'
   4.  Move the cursor to be on ")" and hit "M-TAB"

BACKTRACE

  Debugger entered--Lisp error: (scan-error "Containing expression ends
  premature$
    scan-sexps(13 1)
    forward-sexp(1)
    PC-lisp-complete-symbol()
    call-interactively(PC-lisp-complete-symbol)
    read-from-minibuffer("Eval: " nil (keymap (27 keymap (9
    . PC-lisp-complete-sy$
    (let ((minibuffer-completing-symbol t)) (read-from-minibuffer "Eval: "
    nil re$
    (list (let (...) (read-from-minibuffer "Eval: " nil
    read-expression-map t ...$
    call-interactively(eval-expression)
  
HTH,
- -- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sdl.web@gmail.com: Re: For after-the-release: enhanced partial completion]
  2007-06-05 19:17 [sdl.web@gmail.com: Re: For after-the-release: enhanced partial completion] Richard Stallman
@ 2007-07-16 21:04 ` Sean O'Rourke
  2007-07-16 22:35   ` Leo
  0 siblings, 1 reply; 4+ messages in thread
From: Sean O'Rourke @ 2007-07-16 21:04 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

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

I believe fixes Leo's problem (at least, I don't see it here).
The patch adds "acronym completion" to PC-do-completion for both
symbols and filenames, and within-word completion to
PC-lisp-complete-symbol.  "Acronym completion" means that
e.g. "mvbl" expands to "make-variable-buffer-local", and
"emacs/lisp/wee" to "emacs/lisp/wid-edit.el".  Partial completion
behavior is fairly complex, so would current users please test
this and let me know if it disturbs other behaviors they have
come to expect?  Thanks,

/s

2007-07-16  Sean O'Rourke  <sorourke@cs.ucsd.edu>

	* complete.el (PC-lisp-complete-symbol): complete symbol around
	point.
	(PC-do-completion): Add "acronym completion" for symbols and
	filenames, so e.g. "mvbl" expands to "make-variable-buffer-local".


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 5847 bytes --]

Index: complete.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/complete.el,v
retrieving revision 1.75
diff -p -u -w -r1.75 complete.el
--- complete.el	5 Jul 2007 19:42:43 -0000	1.75
+++ complete.el	16 Jul 2007 21:02:57 -0000
@@ -450,6 +450,7 @@ GOTO-END is non-nil, however, it instead
 	 env-on
 	 regex
 	 p offset
+         abbreviated
 	 (poss nil)
 	 helpposs
 	 (case-fold-search completion-ignore-case))
@@ -586,17 +587,42 @@ GOTO-END is non-nil, however, it instead
                  pred nil))
 
       ;; Find an initial list of possible completions
-      (if (not (setq p (string-match (concat PC-delim-regex
+        (unless (setq p (string-match (concat PC-delim-regex
 					     (if filename "\\|\\*" ""))
 				     str
-				     (+ (length dirname) offset))))
+                                      (+ (length dirname) offset)))
 
 	  ;; Minibuffer contains no hyphens -- simple case!
-	  (setq poss (all-completions (if env-on
-					  basestr str)
+          (setq poss (all-completions (if env-on basestr str)
 				      table
 				      pred))
-
+          (unless poss
+            ;; Try completion as an abbreviation, e.g. "mvb" ->
+            ;; "m-v-b" -> "multiple-value-bind"
+            (setq origstr str
+                  abbreviated t)
+            (if filename
+                (cond
+                  ;; "alpha" or "/alpha" -> expand whole path.
+                  ((string-match "^/?\\([A-Za-z0-9]+\\)$" str)
+                   (setq
+                    basestr ""
+                    p nil
+                    poss (PC-expand-many-files
+                          (concat "/"
+                                  (mapconcat #'list (match-string 1 str) "*/")
+                                  "*"))
+                    beg (1- beg)))
+                  ;; Alphanumeric trailer -> expand trailing file
+                  ((string-match "^\\(.+/\\)\\([A-Za-z0-9]+\\)$" str)
+                   (setq regex (concat "\\`"
+                                        (mapconcat #'list
+                                                   (match-string 2 str)
+                                                   "[A-Za-z0-9]*[^A-Za-z0-9]"))
+                          p (1+ (length (match-string 1 str))))))
+                (setq regex (concat "\\`" (mapconcat #'list str "[^-]*-"))
+                      p 1))))
+        (when p
 	;; Use all-completions to do an initial cull.  This is a big win,
 	;; since all-completions is written in C!
 	(let ((compl (all-completions (if env-on
@@ -605,12 +631,24 @@ GOTO-END is non-nil, however, it instead
                                       table
                                       pred)))
 	  (setq p compl)
+            (when (and compl abbreviated)
+              (if filename
+                  (progn
+                    (setq p nil)
+                    (dolist (x compl)
+                      (when (string-match regex x)
+                        (push x p)))
+                    (setq basestr (try-completion "" p)))
+                  (setq basestr (mapconcat 'list str "-"))
+                  (delete-region beg end)
+                  (setq end (+ beg (length basestr)))
+                  (insert basestr))))
 	  (while p
 	    (and (string-match regex (car p))
 		 (progn
 		   (set-text-properties 0 (length (car p)) '() (car p))
 		   (setq poss (cons (car p) poss))))
-	    (setq p (cdr p)))))
+            (setq p (cdr p))))
 
       ;; If table had duplicates, they can be here.
       (delete-dups poss)
@@ -644,6 +682,7 @@ GOTO-END is non-nil, however, it instead
              (and p (setq poss p))))
 
       ;; Now we have a list of possible completions
+
       (cond
 
        ;; No valid completions found
@@ -653,6 +692,9 @@ GOTO-END is non-nil, however, it instead
 	    (let ((PC-word-failed-flag t))
 	      (delete-backward-char 1)
 	      (PC-do-completion 'word))
+               (when abbreviated
+                 (delete-region beg end)
+                 (insert origstr))
 	  (beep)
 	  (PC-temp-minibuffer-message (if ambig
 					  " [Ambiguous dir name]"
@@ -789,13 +831,18 @@ GOTO-END is non-nil, however, it instead
                           (setq completion-base-size (if dirname
                                                          dirlength
                                                        (- beg prompt-end))))))
-		  (PC-temp-minibuffer-message " [Next char not unique]"))
-		nil)))))
+                             (PC-temp-minibuffer-message " [Next char not unique]"))))))
+           ;; Expansion of filenames is not reversible, so just keep
+           ;; the prefix.
+           (when (and abbreviated filename)
+             (delete-region (point) end))
+           nil)
 
        ;; Only one possible completion
        (t
 	(if (and (equal basestr (car poss))
-		 (not (and env-on filename)))
+                    (not (and env-on filename))
+                    (not abbreviated))
 	    (if (null mode)
 		(PC-temp-minibuffer-message " [Sole completion]"))
 	  (delete-region beg end)
@@ -853,13 +900,11 @@ only symbols with function definitions a
 Otherwise, all symbols with function definitions, values
 or properties are considered."
   (interactive)
-  (let* ((end (point))
-         ;; To complete the word under point, rather than just the portion
-         ;; before point, use this:
-;;;           (save-excursion
-;;;             (with-syntax-table lisp-mode-syntax-table
-;;;               (forward-sexp 1)
-;;;               (point))))
+  (let* ((end
+          (save-excursion
+            (with-syntax-table lisp-mode-syntax-table
+              (skip-syntax-forward "_w")
+              (point))))
 	 (beg (save-excursion
                 (with-syntax-table lisp-mode-syntax-table
                   (backward-sexp 1)

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sdl.web@gmail.com: Re: For after-the-release: enhanced partial completion]
  2007-07-16 21:04 ` Sean O'Rourke
@ 2007-07-16 22:35   ` Leo
  2007-07-17  0:46     ` Sean O'Rourke
  0 siblings, 1 reply; 4+ messages in thread
From: Leo @ 2007-07-16 22:35 UTC (permalink / raw)
  To: emacs-devel

On 2007-07-16 22:04 +0100, Sean O'Rourke wrote:
> I believe fixes Leo's problem (at least, I don't see it here).
> The patch adds "acronym completion" to PC-do-completion for both
> symbols and filenames, and within-word completion to
> PC-lisp-complete-symbol.  "Acronym completion" means that
> e.g. "mvbl" expands to "make-variable-buffer-local", and
> "emacs/lisp/wee" to "emacs/lisp/wid-edit.el".  Partial completion
> behavior is fairly complex, so would current users please test
> this and let me know if it disturbs other behaviors they have
> come to expect?  Thanks,
>
> /s
>
> 2007-07-16  Sean O'Rourke  <sorourke@cs.ucsd.edu>
>
> 	* complete.el (PC-lisp-complete-symbol): complete symbol around
> 	point.
> 	(PC-do-completion): Add "acronym completion" for symbols and
> 	filenames, so e.g. "mvbl" expands to "make-variable-buffer-local".

Has the following been dealt with?

Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/72275>

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sdl.web@gmail.com: Re: For after-the-release: enhanced partial completion]
  2007-07-16 22:35   ` Leo
@ 2007-07-17  0:46     ` Sean O'Rourke
  0 siblings, 0 replies; 4+ messages in thread
From: Sean O'Rourke @ 2007-07-17  0:46 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo <sdl.web@gmail.com> writes:
> Has the following been dealt with?
>
> Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/72275>

I'm still looking at this bug (it evidently happens only on
Unicode 2, which I don't use), but found that a clean checkout
doesn't seem to build.  First, CHARSET_8_BIT_CONTROL is undefined
in src/macterm.c.  Second, even after getting around that, a
whole bunch more charset-related symbols are undefined [1], and I
didn't see anything similar elsewhere in the source.  According
to the ChangeLog, they once lived in charset.h.  Any hints?

/s

[1]
macterm.c:10392: error: 'charset_latin_iso8859_1' undeclared (first use in this function)
macterm.c:10392: error: (Each undeclared identifier is reported only once
macterm.c:10392: error: for each function it appears in.)
macterm.c:10399: error: 'charset_mule_unicode_0100_24ff' undeclared (first use in this function)
macterm.c:10402: error: 'charset_mule_unicode_2500_33ff' undeclared (first use in this function)
macterm.c:10405: error: 'charset_mule_unicode_e000_ffff' undeclared (first use in this function)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-17  0:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 19:17 [sdl.web@gmail.com: Re: For after-the-release: enhanced partial completion] Richard Stallman
2007-07-16 21:04 ` Sean O'Rourke
2007-07-16 22:35   ` Leo
2007-07-17  0:46     ` Sean O'Rourke

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).