unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* getting abbrev table objects given a string with the same name
@ 2004-06-22 16:50 Benjamin Rutt
  2004-06-22 17:47 ` Thien-Thi Nguyen
  2004-06-22 20:54 ` Kevin Rodgers
  0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Rutt @ 2004-06-22 16:50 UTC (permalink / raw)


How can I do something like the following:

(define-abbrev (concat "c-mode" "-abbrev-table") "foo" "bar" nil)

What I want is to define an abbrev based on an abbrev table name that
is dyamically built.  The problem is, the 1st arg to define-abbrev
must be an abbrev table, not a string.  So, the problem becomes, how
can I get an abbrev table, given a string with the same name.
-- 
Benjamin Rutt

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

* Re: getting abbrev table objects given a string with the same name
  2004-06-22 16:50 getting abbrev table objects given a string with the same name Benjamin Rutt
@ 2004-06-22 17:47 ` Thien-Thi Nguyen
  2004-06-22 21:06   ` Benjamin Rutt
  2004-06-22 20:54 ` Kevin Rodgers
  1 sibling, 1 reply; 4+ messages in thread
From: Thien-Thi Nguyen @ 2004-06-22 17:47 UTC (permalink / raw)


Benjamin Rutt <rutt.4+news@osu.edu> writes:

> how can I get an abbrev table, given a string with the same name.

this expression doesn't answer your question directly,
but in understanding it you will find the answer anyway:

(let ((name (concat "describe" "-" "function")))
  (eval `(,(intern name) ',(intern name))))

thi

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

* Re: getting abbrev table objects given a string with the same name
  2004-06-22 16:50 getting abbrev table objects given a string with the same name Benjamin Rutt
  2004-06-22 17:47 ` Thien-Thi Nguyen
@ 2004-06-22 20:54 ` Kevin Rodgers
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2004-06-22 20:54 UTC (permalink / raw)


Benjamin Rutt wrote:
 > How can I do something like the following:
 >
 > (define-abbrev (concat "c-mode" "-abbrev-table") "foo" "bar" nil)
 >
 > What I want is to define an abbrev based on an abbrev table name that
 > is dyamically built.  The problem is, the 1st arg to define-abbrev
 > must be an abbrev table, not a string.  So, the problem becomes, how
 > can I get an abbrev table, given a string with the same name.

You need to get from a string, to a symbol with the same name (with
intern), to it's value (with symbol-value):

(symbol-value (intern (concat "c-mode" "-abbrev-table")))

-- 
Kevin Rodgers

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

* Re: getting abbrev table objects given a string with the same name
  2004-06-22 17:47 ` Thien-Thi Nguyen
@ 2004-06-22 21:06   ` Benjamin Rutt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Rutt @ 2004-06-22 21:06 UTC (permalink / raw)


Thien-Thi Nguyen <ttn@glug.org> writes:

> Benjamin Rutt <rutt.4+news@osu.edu> writes:
>
>> how can I get an abbrev table, given a string with the same name.
>
> this expression doesn't answer your question directly,
> but in understanding it you will find the answer anyway:
>
> (let ((name (concat "describe" "-" "function")))
>   (eval `(,(intern name) ',(intern name))))

Thanks, `intern' and `eval' did the trick.
-- 
Benjamin Rutt

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

end of thread, other threads:[~2004-06-22 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-22 16:50 getting abbrev table objects given a string with the same name Benjamin Rutt
2004-06-22 17:47 ` Thien-Thi Nguyen
2004-06-22 21:06   ` Benjamin Rutt
2004-06-22 20:54 ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).