all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Volkan YAZICI <volkan.yazici@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: COMPLETING-READ Problem
Date: Mon, 10 Mar 2008 00:34:36 -0700 (PDT)	[thread overview]
Message-ID: <d9d5c323-8491-446c-b011-81d599cdabaf@f63g2000hsf.googlegroups.com> (raw)
In-Reply-To: mailman.8610.1205089639.18990.help-gnu-emacs@gnu.org

On 9 Mart, 21:05, "Drew Adams" <drew.ad...@oracle.com> wrote:
> You pass `completing-read' an empty TABLE argument: you never fill
> `previously-searched-tables', so it is nil.
>
> And you never add any alist entry (table . <something) to
> `searched-sql-items'. Seehttp://www.groupsrv.com/computers/about240758.html.

(I totally missed the scope of LET block inside INTERACTIVE call.)
Thanks for your (setf (assoc ...) ...) pointer. It appears to be I
completely forgot how to use ASSOC. Anyway, after facing with some
other problems, I decided to continue with hash tables. Here is the
latest code:

(defun search-sql-table (table-name)
  "Search for specified TABLE-NAME in the current buffer."
  (interactive
   (let ((previously-searched-tables
          (and (hash-table-p searched-sql-items)
               (gethash '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.
  (unless (hash-table-p searched-sql-items)
    (setq searched-sql-items (make-hash-table)))
  (setf (gethash 'table searched-sql-items)
        ;; Move TABLE-NAME to top.
        (cons table-name (remove table-name (gethash 'table searched-
sql-items))))
  ;; Search table.
  (search-forward (format "CREATE TABLE %s" table-name)))

It seems to be working for now. If you see any other problems, I'd be
appreciated if you can report them. Thanks so much for your kindly
replies.


Regards.


      parent reply	other threads:[~2008-03-10  7:34 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
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 [this message]

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=d9d5c323-8491-446c-b011-81d599cdabaf@f63g2000hsf.googlegroups.com \
    --to=volkan.yazici@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.