all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Name completion for library
@ 2005-08-06 18:36 Tim Johnson
  2005-08-06 18:51 ` Peter Dyballa
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Johnson @ 2005-08-06 18:36 UTC (permalink / raw)


OS is Linux RH 9.0 ver 21.2.1

If I type M-x load-l and TAB, emacs completes the
name to 'load-library'.

If I then begin to type in the library name and
press TAB, emacs inserts the literal TAB and does not
present name completion.

How may I enable this?
Pointers to help, docs, URLs and info nodes is invited.

TIA
tj

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

* Re: Name completion for library
  2005-08-06 18:36 Name completion for library Tim Johnson
@ 2005-08-06 18:51 ` Peter Dyballa
  2005-08-06 19:31   ` Tim Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Dyballa @ 2005-08-06 18:51 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 06.08.2005 um 20:36 schrieb Tim Johnson:

> If I type M-x load-l and TAB, emacs completes the
> name to 'load-library'.
>
> If I then begin to type in the library name and
> press TAB, emacs inserts the literal TAB and does not
> present name completion.
>

load-library takes the name of a 'library' -- an Elisp file's name from 
the load-path, not a path name. If you want to use file name 
completion, try load-file!

Look at the load function in files.el!

--
Greetings

   Pete

If you're not confused, you're not paying attention

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

* Re: Name completion for library
  2005-08-06 18:51 ` Peter Dyballa
@ 2005-08-06 19:31   ` Tim Johnson
  2005-08-06 19:38     ` Peter Dyballa
  2005-08-06 19:39     ` Lennart Borgman
  0 siblings, 2 replies; 6+ messages in thread
From: Tim Johnson @ 2005-08-06 19:31 UTC (permalink / raw)


* Peter Dyballa <Peter_Dyballa@Web.DE> [050806 11:00]:
> 
> Am 06.08.2005 um 20:36 schrieb Tim Johnson:
> 
> >If I type M-x load-l and TAB, emacs completes the
> >name to 'load-library'.
> >
> >If I then begin to type in the library name and
> >press TAB, emacs inserts the literal TAB and does not
> >present name completion.
> >
 
  Hello Peter:

> load-library takes the name of a 'library' -- an Elisp file's name from 
> the load-path, not a path name. If you want to use file name 
> completion, try load-file!
 
  Shucks! Xemacs will complete a library name, was hoping GNU
  emacs would also.

> Look at the load function in files.el!
 
  Thanks.
  Will do so.

> --
> Greetings
> 
>   Pete
> 
> If you're not confused, you're not paying attention

  I must be *really* paying attention.
  Cheers
  tim
  
-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

* Re: Name completion for library
  2005-08-06 19:31   ` Tim Johnson
@ 2005-08-06 19:38     ` Peter Dyballa
  2005-08-06 19:39     ` Lennart Borgman
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2005-08-06 19:38 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 06.08.2005 um 21:31 schrieb Tim Johnson:

>   Shucks! Xemacs will complete a library name, was hoping GNU
>   emacs would also.
>

Could be GNU Emacs can too -- I just don't know and therefore load all 
needed code with require  ...

--
Greetings

   Pete

A child of five could understand this!  Fetch me a child of five.

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

* Re: Name completion for library
  2005-08-06 19:31   ` Tim Johnson
  2005-08-06 19:38     ` Peter Dyballa
@ 2005-08-06 19:39     ` Lennart Borgman
  2005-08-08 19:20       ` Kevin Rodgers
  1 sibling, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2005-08-06 19:39 UTC (permalink / raw)
  Cc: help-gnu-emacs

Tim Johnson wrote:

>  Shucks! Xemacs will complete a library name, was hoping GNU
>  emacs would also.
>  
>
It will. Soon I hope. When next version is released.

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

* Re: Name completion for library
  2005-08-06 19:39     ` Lennart Borgman
@ 2005-08-08 19:20       ` Kevin Rodgers
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2005-08-08 19:20 UTC (permalink / raw)


Lennart Borgman wrote:
 > Tim Johnson wrote:
 >>  Shucks! Xemacs will complete a library name, was hoping GNU
 >>  emacs would also.
 >>
 > It will. Soon I hope. When next version is released.

Or you can crib the Emacs 22 code from CVS.  I've almost got it working
in Emacs 21 (see the comments):

;; From Emacs 22 src/lread.c:
(defvar load-suffixes '(".elc" ".el")
   "List of suffixes to try for files to load.
This list should not include the empty string.")

(eval-when-compile
   (require 'cl))			; Emacs 21

;; From Emacs 22 lisp/files.el:
(defun locate-file-completion (string path-and-suffixes action)
   "Do completion for file names passed to `locate-file'.
PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
   (if (file-name-absolute-p string)
       (read-file-name-internal string nil action)
     (let ((names nil)
	  (suffix (concat (regexp-opt (cdr path-and-suffixes) t) "\\'"))
	  (string-dir (file-name-directory string)))
       (dolist (dir (car path-and-suffixes))
	(unless dir
	  (setq dir default-directory))
	(if string-dir (setq dir (expand-file-name string-dir dir)))
	(when (file-directory-p dir)
	  (dolist (file (file-name-all-completions
			 (file-name-nondirectory string) dir))
	    (push (if string-dir (concat string-dir file) file) names)
	    (when (string-match suffix file)
	      (setq file (substring file 0 (match-beginning 0)))
	      (push (if string-dir (concat string-dir file) file) names)))))
       (setq names (mapcar 'list names))	; Emacs 21
       (cond
        ((eq action t) (all-completions string names))
        ((null action) (try-completion string names))
        (t nil)				; Emacs 21
        (t (test-completion string names))))))

(defadvice load-library (before interactive activate)
   "Provide completion when reading the library name."
   (interactive (list
                 (completing-read "Load library: "
                                  'locate-file-completion
                                  (cons load-path load-suffixes)))))

-- 
Kevin Rodgers

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

end of thread, other threads:[~2005-08-08 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-06 18:36 Name completion for library Tim Johnson
2005-08-06 18:51 ` Peter Dyballa
2005-08-06 19:31   ` Tim Johnson
2005-08-06 19:38     ` Peter Dyballa
2005-08-06 19:39     ` Lennart Borgman
2005-08-08 19:20       ` Kevin Rodgers

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.