all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elisp question: how to walk through a variable like special-display-buffer-names
@ 2004-01-13 13:45 leo
  2004-01-13 15:07 ` Joakim Hove
  0 siblings, 1 reply; 6+ messages in thread
From: leo @ 2004-01-13 13:45 UTC (permalink / raw)


hi there

i want to walk through the list in special-display-buffer-names (and
special-display-regexps), in order to find out if the left parameter is
set in the contained alist.

emacs itself m,ust do similar things after creating frames, but i
couldn't find a hint in emacs' lisp-files.

so, are there some ready made functions to walk through "lists of elements
which are possbily again lists containing a car (buffer-name) with an
alist (frame-parameters)."

even harder and more interesting for the special=display-regexps case...

thanks in advance, leo

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

* Re: elisp question: how to walk through a variable like special-display-buffer-names
  2004-01-13 13:45 elisp question: how to walk through a variable like special-display-buffer-names leo
@ 2004-01-13 15:07 ` Joakim Hove
  2004-01-13 15:30   ` Klaus Berndl
  2004-01-13 15:42   ` Jesper Harder
  0 siblings, 2 replies; 6+ messages in thread
From: Joakim Hove @ 2004-01-13 15:07 UTC (permalink / raw)



leo <leo@bella.local> writes:

>i want to walk through the list in special-display-buffer-names (and
>special-display-regexps), in order to find out if the left parameter is
>set in the contained alist.

Well,

I personally like (dolist) a lot:

(require 'cl)
(dolist (el list)
   ;; do something with el
   (let ((buffer (car el))
         (alist  (cdr el)))     
    ;;
    ;; But then ...
    ;;
    )) 

I dont understand what you mean with 'contained alist' - but you might
need the assoc function.


HTH - Joakim

-- 
  /--------------------------------------------------------------------\
 / Joakim Hove  / hove@bccs.no  /  (55 5) 84076       |                 \
 | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
 | CMU                                                | 5231 Paradis    |
 \ Thormøhlensgt.55, 5020 Bergen.                     | 55 91 28 18     /
  \--------------------------------------------------------------------/

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

* Re: elisp question: how to walk through a variable like special-display-buffer-names
  2004-01-13 15:07 ` Joakim Hove
@ 2004-01-13 15:30   ` Klaus Berndl
  2004-01-13 23:58     ` leo
  2004-01-13 15:42   ` Jesper Harder
  1 sibling, 1 reply; 6+ messages in thread
From: Klaus Berndl @ 2004-01-13 15:30 UTC (permalink / raw)


On Tue, 13 Jan 2004, Joakim Hove wrote:

>  
>  leo <leo@bella.local> writes:
>  
> >i want to walk through the list in special-display-buffer-names (and
> >special-display-regexps), in order to find out if the left parameter is
> >set in the contained alist.
>  
>  Well,
>  
>  I personally like (dolist) a lot:
>  
>  (require 'cl)

With current GNU Emacs 21 you do not need require 'cl because `dolist' and
`dotimes' are now builtin functions of Emacs.
Another way is using `mapc' which walks through a list too.

Do not know which one is preferable - maybe some Lisp-Gurus can answer this...

Klaus

>  (dolist (el list)
>     ;; do something with el
>     (let ((buffer (car el))
>           (alist  (cdr el)))     
>      ;;
>      ;; But then ...
>      ;;
>      )) 
>  
>  I dont understand what you mean with 'contained alist' - but you might
>  need the assoc function.
>  
>  
>  HTH - Joakim

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Carl-Wery-Str. 42, 81739 Muenchen, Germany
Tel +49 89 63812-392, Fax -220

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

* Re: elisp question: how to walk through a variable like special-display-buffer-names
  2004-01-13 15:07 ` Joakim Hove
  2004-01-13 15:30   ` Klaus Berndl
@ 2004-01-13 15:42   ` Jesper Harder
  1 sibling, 0 replies; 6+ messages in thread
From: Jesper Harder @ 2004-01-13 15:42 UTC (permalink / raw)


Joakim Hove <hove@bccs.no> writes:

> I personally like (dolist) a lot:
>
> (require 'cl)
> (dolist (el list)

You don't need cl for `dolist' (in Emacs 21).

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

* Re: elisp question: how to walk through a variable like special-display-buffer-names
  2004-01-13 15:30   ` Klaus Berndl
@ 2004-01-13 23:58     ` leo
  2004-01-14  5:23       ` Martin Rydstr|m
  0 siblings, 1 reply; 6+ messages in thread
From: leo @ 2004-01-13 23:58 UTC (permalink / raw)


i couldn't find joakim's direct reply post, that's why i answer to klaus'
reply:

"Klaus Berndl" <klaus.berndl@sdm.de> wrote in message
news:uk73vlvct.fsf@sdm.de...
> On Tue, 13 Jan 2004, Joakim Hove wrote:
>
> >
> >  leo <leo@bella.local> writes:
> >
> > >i want to walk through the list in special-display-buffer-names (and
> > >special-display-regexps), in order to find out if the left parameter is
> > >set in the contained alist.
> >
> >  Well,
> >
> >  I personally like (dolist) a lot:
>>
> >  (dolist (el list)
> >     ;; do something with el
> >     (let ((buffer (car el))
> >           (alist  (cdr el)))
> >      ;;
> >      ;; But then ...
> >      ;;
> >      ))

ok, i just hoped that there might be a function in emacs for that: emacs has
so many variables which contain lists of lists or regexps...

but thanks for the tip with dolist!

> >  I dont understand what you mean with 'contained alist' - but you might
> >  need the assoc function.

well, special-display-buffer-names can have the follwoing structure:

'( (name-of-buffer1 (parameter1 . value_a) (parameter2 . value_b) ...)
   (name-of-buffer2 (parameter1 . value_c) (parameter2 . value_d) ...)
   (name-of-buffer2 (parameter1 . value_e) (parameter2 . value_f) ...)
   ...)

and i want to pull out e.g. the value for parameter2 for a specific buffer
name, say name-of-buffer2 with a function i feed with the parameter-symbol
and the buffer-name.

cheers, leo

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

* Re: elisp question: how to walk through a variable like special-display-buffer-names
  2004-01-13 23:58     ` leo
@ 2004-01-14  5:23       ` Martin Rydstr|m
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Rydstr|m @ 2004-01-14  5:23 UTC (permalink / raw)


"leo" <halloleo@noospaam.myrealbox.com> writes:
> well, special-display-buffer-names can have the follwoing structure:
> 
> '( (name-of-buffer1 (parameter1 . value_a) (parameter2 . value_b) ...)
>    (name-of-buffer2 (parameter1 . value_c) (parameter2 . value_d) ...)
>    (name-of-buffer2 (parameter1 . value_e) (parameter2 . value_f) ...)
>    ...)
> 
> and i want to pull out e.g. the value for parameter2 for a specific buffer
> name, say name-of-buffer2 with a function i feed with the parameter-symbol
> and the buffer-name.

Does

(defun leo-get-sdbn-param (buffer-name parameter-symbol)
  (cdr (assoc parameter-symbol 
              (cdr (assoc buffer-name special-display-buffer-names)))))

help any?

Regards,

'mr

-- 
[Emacs] is written in Lisp, which is the only computer language that is
beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_

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

end of thread, other threads:[~2004-01-14  5:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-13 13:45 elisp question: how to walk through a variable like special-display-buffer-names leo
2004-01-13 15:07 ` Joakim Hove
2004-01-13 15:30   ` Klaus Berndl
2004-01-13 23:58     ` leo
2004-01-14  5:23       ` Martin Rydstr|m
2004-01-13 15:42   ` Jesper Harder

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.