help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: COMPLETING-READ Problem


From: Volkan YAZICI
Subject: Re: COMPLETING-READ Problem
Date: Mon, 10 Mar 2008 00:34:36 -0700 (PDT)
User-agent: G2/1.0

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]