mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
* readline.scm (apropos-completion-function): Don't define and
install if the 'regex feature is missing.
This commit is contained in:
parent
69fc343a70
commit
ebfa2cd5ca
1 changed files with 18 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
||||||
;;;; readline.scm --- support functions for command-line editing
|
;;;; readline.scm --- support functions for command-line editing
|
||||||
;;;;
|
;;;;
|
||||||
;;;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
|
;;;; Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; This program is free software; you can redistribute it and/or modify
|
;;;; This program is free software; you can redistribute it and/or modify
|
||||||
;;;; it under the terms of the GNU General Public License as published by
|
;;;; it under the terms of the GNU General Public License as published by
|
||||||
|
@ -148,21 +148,24 @@
|
||||||
(define-public (set-readline-read-hook! h)
|
(define-public (set-readline-read-hook! h)
|
||||||
(set! read-hook h))
|
(set! read-hook h))
|
||||||
|
|
||||||
(define-public apropos-completion-function
|
(if (feature? 'regex)
|
||||||
|
(begin
|
||||||
|
(define-public apropos-completion-function
|
||||||
(let ((completions '()))
|
(let ((completions '()))
|
||||||
(lambda (text cont?)
|
(lambda (text cont?)
|
||||||
(if (not cont?)
|
(if (not cont?)
|
||||||
(set! completions
|
(set! completions
|
||||||
(map symbol->string
|
(map symbol->string
|
||||||
(apropos-internal (string-append "^"
|
(apropos-internal
|
||||||
(regexp-quote text))))))
|
(string-append "^" (regexp-quote text))))))
|
||||||
(if (null? completions)
|
(if (null? completions)
|
||||||
#f
|
#f
|
||||||
(let ((retval (car completions)))
|
(let ((retval (car completions)))
|
||||||
(begin (set! completions (cdr completions))
|
(begin (set! completions (cdr completions))
|
||||||
retval))))))
|
retval))))))
|
||||||
|
|
||||||
(set! *readline-completion-function* apropos-completion-function)
|
(set! *readline-completion-function* apropos-completion-function)
|
||||||
|
))
|
||||||
|
|
||||||
(define-public (activate-readline)
|
(define-public (activate-readline)
|
||||||
(if (and (isatty? (current-input-port))
|
(if (and (isatty? (current-input-port))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue