unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tool for writing thin wrappers for changing existing elisp configurations
@ 2014-04-07 18:40 Andrey Tykhonov
  2014-04-08  5:35 ` Andreas Röhler
  2014-04-10  7:45 ` Suvayu Ali
  0 siblings, 2 replies; 4+ messages in thread
From: Andrey Tykhonov @ 2014-04-07 18:40 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List,

is there any way to change configuration files by means of elisp functions?
Which of them may help?

For example, there are such lines in the ~/.gnus.el (but please note that
that question is not about Gnus):

#+begin_src elisp
(setq nnmail-split-fancy
      '(|
        (: nnmail-split-fancy-with-parent )
        (any "help-gnu-emacs@gnu\\.org" "help-gnu-emacs")
        (any "emacs-devel@gnu\\.org" "emacs-devel")
        "mail.misc"))
#+end_src

I would like to write a thin wrapper, interactive elisp function, which
will be able to append new entry to the `nnmail-split-fancy'.

When I will call that function (M-x add-nnmail-split-fancy-entry) then I'll
be prompted for email address and imap folder (let 'any' will be
hard-coded). Thus such command execution:

M-x add-nnmail-split-fancy-entry RET emacs-orgmode@gnu.org RET
emacs-orgmode RET

will change configuration of the mentioned lines to the following:

#+begin_src elisp
(setq nnmail-split-fancy
      '(|
        (: nnmail-split-fancy-with-parent )
        (any "help-gnu-emacs@gnu\\.org" "help-gnu-emacs")
        (any "emacs-devel@gnu\\.org" "emacs-devel")
        (any "emacs-orgmode@gnu\\.org" "emacs-orgmode")
        "mail.misc"))
#+end_src
        
Yes, of course, I can just open ~/.gnus.el and add such entry. And of
course I can change via M-x customize-variable RET nnmail-split-fancy RET.

But this question is not about *how* to change existing elisp configuration
but about a tool. I wonder: is there any elisp tool (package, functions
etc) which allows to write such a thin wrapper (elisp program); wrapper
which allows to change source of existing elisp program (configuration)?

How would you implement such a wrapper? Any suggestions? Would you suggest
to investigate how does work `customize-variable'? What else?



Andrey



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

* Re: Tool for writing thin wrappers for changing existing elisp configurations
  2014-04-07 18:40 Tool for writing thin wrappers for changing existing elisp configurations Andrey Tykhonov
@ 2014-04-08  5:35 ` Andreas Röhler
       [not found]   ` <CAM7J8HKs-asCt9skPYLjM8ry+_vxrgoq5j7r-HSsmqMA99Xa3Q@mail.gmail.com>
  2014-04-10  7:45 ` Suvayu Ali
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2014-04-08  5:35 UTC (permalink / raw)
  To: help-gnu-emacs

Am 07.04.2014 20:40, schrieb Andrey Tykhonov:
>
> Hi List,
>
> is there any way to change configuration files by means of elisp functions?
> Which of them may help?
>
> For example, there are such lines in the ~/.gnus.el (but please note that
> that question is not about Gnus):
>
> #+begin_src elisp
> (setq nnmail-split-fancy
>        '(|
>          (: nnmail-split-fancy-with-parent )
>          (any "help-gnu-emacs@gnu\\.org" "help-gnu-emacs")
>          (any "emacs-devel@gnu\\.org" "emacs-devel")
>          "mail.misc"))
> #+end_src
>
> I would like to write a thin wrapper, interactive elisp function, which
> will be able to append new entry to the `nnmail-split-fancy'.
>
> When I will call that function (M-x add-nnmail-split-fancy-entry) then I'll
> be prompted for email address and imap folder (let 'any' will be
> hard-coded). Thus such command execution:
>
> M-x add-nnmail-split-fancy-entry RET emacs-orgmode@gnu.org RET
> emacs-orgmode RET
>
> will change configuration of the mentioned lines to the following:
>
> #+begin_src elisp
> (setq nnmail-split-fancy
>        '(|
>          (: nnmail-split-fancy-with-parent )
>          (any "help-gnu-emacs@gnu\\.org" "help-gnu-emacs")
>          (any "emacs-devel@gnu\\.org" "emacs-devel")
>          (any "emacs-orgmode@gnu\\.org" "emacs-orgmode")
>          "mail.misc"))
> #+end_src
>
> Yes, of course, I can just open ~/.gnus.el and add such entry. And of
> course I can change via M-x customize-variable RET nnmail-split-fancy RET.
>
> But this question is not about *how* to change existing elisp configuration
> but about a tool. I wonder: is there any elisp tool (package, functions
> etc) which allows to write such a thin wrapper (elisp program); wrapper
> which allows to change source of existing elisp program (configuration)?
>
> How would you implement such a wrapper? Any suggestions? Would you suggest
> to investigate how does work `customize-variable'? What else?
>
>
>
> Andrey
>
>

You could have a batch file calling Emacs to change existing file(s) as you can change this files calling other programs.
Also loading a certain init file might be an option, keeping several init-files.

Emacs init files are in Emacs lisp as others. Don't see anything special so far when changing it.

HTH,

Andreas




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

* Re: Tool for writing thin wrappers for changing existing elisp configurations
       [not found]   ` <CAM7J8HKs-asCt9skPYLjM8ry+_vxrgoq5j7r-HSsmqMA99Xa3Q@mail.gmail.com>
@ 2014-04-10  5:53     ` Andreas Röhler
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Röhler @ 2014-04-10  5:53 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org List

Am 10.04.2014 01:55, schrieb Andrey Tykhonov:

>
> Yes, but I want to have only one init-file and change by means of program
> (change a program by means of a program).
>

you can have in your init file something like that pseudo-code:

(finde-file...
search-and-replace..

reload-that-buffer

etc.

Or write

(cond (first-condition
        (load-or-just-find .... (and change?)





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

* Re: Tool for writing thin wrappers for changing existing elisp configurations
  2014-04-07 18:40 Tool for writing thin wrappers for changing existing elisp configurations Andrey Tykhonov
  2014-04-08  5:35 ` Andreas Röhler
@ 2014-04-10  7:45 ` Suvayu Ali
  1 sibling, 0 replies; 4+ messages in thread
From: Suvayu Ali @ 2014-04-10  7:45 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, Apr 07, 2014 at 09:40:35PM +0300, Andrey Tykhonov wrote:
> 
> I would like to write a thin wrapper, interactive elisp function, which
> will be able to append new entry to the `nnmail-split-fancy'.

 [...chomp...chomp...chomp...]

> Yes, of course, I can just open ~/.gnus.el and add such entry. And of
> course I can change via M-x customize-variable RET nnmail-split-fancy RET.
> 
> But this question is not about *how* to change existing elisp configuration
> but about a tool. I wonder: is there any elisp tool (package, functions
> etc) which allows to write such a thin wrapper (elisp program); wrapper
> which allows to change source of existing elisp program (configuration)?

If you don't want to use customize, maybe see how it does it and base
your tool on that?  The only tool I know which does this is customize.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.



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

end of thread, other threads:[~2014-04-10  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-07 18:40 Tool for writing thin wrappers for changing existing elisp configurations Andrey Tykhonov
2014-04-08  5:35 ` Andreas Röhler
     [not found]   ` <CAM7J8HKs-asCt9skPYLjM8ry+_vxrgoq5j7r-HSsmqMA99Xa3Q@mail.gmail.com>
2014-04-10  5:53     ` Andreas Röhler
2014-04-10  7:45 ` Suvayu Ali

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).