all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Volkan YAZICI <volkan.yazici@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: COMPLETING-READ Problem
Date: Sun, 09 Mar 2008 17:03:14 +0100	[thread overview]
Message-ID: <87zlt7rikd.fsf@thievol.homelinux.org> (raw)
In-Reply-To: <dc605a8a-b438-4b32-af18-70ed52a8b171@n36g2000hse.googlegroups.com> (Volkan YAZICI's message of "Sun, 9 Mar 2008 05:51:44 -0700 (PDT)")

Volkan YAZICI <volkan.yazici@gmail.com> writes:

> Hi,
>
> While trying to implement a family of SQL identifier search functions,
> I want to offer tab completion to previously searched SQL identifiers
> -- besides builtin history functionality binded to M-p. For this
> purpose, I try to use COMPLETING-READ. Here's the related code
> snippet:
>
> (defvar searched-sql-items nil
>   "Association list of previously searched SQL items.")
>
> (defun make-local-searched-sql-items ()
>   "Creates per-buffer SEARCHED-SQL-ITEMS association list."
>   (make-local-variable 'searched-sql-items))
>
> (add-hook 'sql-mode-hook 'make-local-searched-sql-items)
>
> (defun search-sql-table (table-name)
>   "Search for specified TABLE-NAME in the current buffer."
>   (interactive
>    (let ((previously-searched-tables (assoc 'table searched-sql-
> items)))
>      (list
>       (completing-read
>        (if previously-searched-tables
>            (format "Table name (default: %s): "
>                    (first previously-searched-tables))
>          "Table name: ")
>        previously-searched-tables)))
>    ;; Insert specified TABLE-NAME to SEARCHED-SQL-ITEMS.
>    (let ((previously-searched-tables (assoc 'table searched-sql-
> items)))
>      (setf (assoc 'table searched-sql-items)
>            ;; Move TABLE-NAME to top.
>            (cons table-name (remove table-name previously-searched-
> tables))))
>    ;; Search table.
>    (search-forward (format "CREATE TABLE %s" table-name))))
>
> But for some reason, function doesn't work. (Does nothing during
> execution.) I tried to place a (warn "TABLE-NAME: %s" table-name) just
> after (interactive ...) block, but there doesn't appear anything in
> the *Messages* buffer. Any ideas?
>
>
> Regards.
>
I think you have to put your completing-read outside of the let body.
-- 
A + Thierry
Pub key: http://pgp.mit.edu




  reply	other threads:[~2008-03-09 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-09 12:51 COMPLETING-READ Problem Volkan YAZICI
2008-03-09 16:03 ` Thierry Volpiatto [this message]
2008-03-09 16:15 ` Thierry Volpiatto
2008-03-09 19:05 ` Drew Adams
     [not found] ` <mailman.8610.1205089639.18990.help-gnu-emacs@gnu.org>
2008-03-10  7:34   ` Volkan YAZICI

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=87zlt7rikd.fsf@thievol.homelinux.org \
    --to=thierry.volpiatto@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=volkan.yazici@gmail.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.