unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* utf-translate-cjk only settable via Customize
@ 2003-03-10 14:49 Kai Großjohann
  2003-03-11 20:04 ` Stefan Monnier
  2003-03-29 17:46 ` Kai Großjohann
  0 siblings, 2 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-03-10 14:49 UTC (permalink / raw)


Should a function for setting the variable be created?

My suggestion would be to create a function utf-translate-cjk-mode
based on the :set expression for utf-translate-cjk and then change
the :set expression to invoke that function.

OK to fix?

(There is a relation to the custom-setq discussion currently going
on -- when custom-setq is added to Emacs, the previously described
change might not be necessary anymore.)
-- 
A preposition is not a good thing to end a sentence with.

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-10 14:49 utf-translate-cjk only settable via Customize Kai Großjohann
@ 2003-03-11 20:04 ` Stefan Monnier
  2003-03-17 14:06   ` Kai Großjohann
  2003-03-29 17:46 ` Kai Großjohann
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2003-03-11 20:04 UTC (permalink / raw)
  Cc: emacs-devel

> My suggestion would be to create a function utf-translate-cjk-mode
> based on the :set expression for utf-translate-cjk and then change
> the :set expression to invoke that function.

Why not make it into a minor mode ?


	Stefan

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-11 20:04 ` Stefan Monnier
@ 2003-03-17 14:06   ` Kai Großjohann
  2003-03-22 21:38     ` Stefan Monnier
  2003-03-23  2:52     ` Richard Stallman
  0 siblings, 2 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-03-17 14:06 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:

>> My suggestion would be to create a function utf-translate-cjk-mode
>> based on the :set expression for utf-translate-cjk and then change
>> the :set expression to invoke that function.
>
> Why not make it into a minor mode ?

That's a good idea in principle, and I've now started on it.
However, the original defcustom contains a :set-after keyword and a
:version keyword.  Can these be put into the define-minor-mode?

[time passes]

The keyword :extra-args for define-minor-mode is not documented.

[pondering]

It ought to be easy to augment define-minor-mode to grok more keyword
args.  But is this the right approach?  Do we want a
:extra-defcustom-args thing that contains a list of those additional
args to defcustom?
-- 
A preposition is not a good thing to end a sentence with.

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-17 14:06   ` Kai Großjohann
@ 2003-03-22 21:38     ` Stefan Monnier
  2003-03-23 10:50       ` Kai Großjohann
  2003-03-23  2:52     ` Richard Stallman
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2003-03-22 21:38 UTC (permalink / raw)
  Cc: emacs-devel

> >> My suggestion would be to create a function utf-translate-cjk-mode
> >> based on the :set expression for utf-translate-cjk and then change
> >> the :set expression to invoke that function.
> >
> > Why not make it into a minor mode ?
> 
> That's a good idea in principle, and I've now started on it.
> However, the original defcustom contains a :set-after keyword and a
> :version keyword.  Can these be put into the define-minor-mode?

IIRC, additional keyword args are just passed on to defcustom.
I did this specifically for :version.


	Stefan

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-17 14:06   ` Kai Großjohann
  2003-03-22 21:38     ` Stefan Monnier
@ 2003-03-23  2:52     ` Richard Stallman
  2003-03-23 10:56       ` Kai Großjohann
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2003-03-23  2:52 UTC (permalink / raw)
  Cc: emacs-devel

    It ought to be easy to augment define-minor-mode to grok more keyword
    args.  But is this the right approach?  Do we want a
    :extra-defcustom-args thing that contains a list of those additional
    args to defcustom?

Would you please explain what you are trying to achieve?
I don't see what purpose any of this would serve.

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-22 21:38     ` Stefan Monnier
@ 2003-03-23 10:50       ` Kai Großjohann
  2003-03-24 15:30         ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-03-23 10:50 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:

>> That's a good idea in principle, and I've now started on it.
>> However, the original defcustom contains a :set-after keyword and a
>> :version keyword.  Can these be put into the define-minor-mode?
>
> IIRC, additional keyword args are just passed on to defcustom.
> I did this specifically for :version.

I was confused by the following bit of code in define-minor-mode:

    ;; Check keys.
    (while (keywordp (car body))
      (case (pop body)
	(:init-value (setq init-value (pop body)))
	(:lighter (setq lighter (pop body)))
	(:global (setq globalp (pop body)))
	(:extra-args (setq extra-args (pop body)))
	(:group (setq group (nconc group (list :group (pop body)))))
	(:require (setq require (pop body)))
	(t (pop body))))

It seemed to me that the `t' case just throws away the keyword and its
arg.

Hm.  Now I'm looking again, at the generated defcustom statement, and
I really can't see the extra args being passed :-/  Is it just me
being stupid?
-- 
A preposition is not a good thing to end a sentence with.

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-23  2:52     ` Richard Stallman
@ 2003-03-23 10:56       ` Kai Großjohann
  2003-03-24 19:27         ` Richard Stallman
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-03-23 10:56 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     It ought to be easy to augment define-minor-mode to grok more keyword
>     args.  But is this the right approach?  Do we want a
>     :extra-defcustom-args thing that contains a list of those additional
>     args to defcustom?
>
> Would you please explain what you are trying to achieve?
> I don't see what purpose any of this would serve.

The variable utf-translate-cjk must be set via Customize to achieve
the desired effect.  Stefan suggested to make a minor mode such that
people can just invoke that via Lisp and don't have to use Customize.
I was following this discussion and looked at define-minor-mode to do
that.  So I wanted to replace the current (defcustom utf-translate-cjk
...) statement with a (define-minor-mode utf-translate-cjk-mode ...)
statement.

The defcustom for utf-translate-cjk contains several keyword args:
:set, :version, :type, :set-after, and :group.  define-minor-mode is
a macro that expands to a defcustom statement.  I couldn't see how to
inject the :version and :set-after keywords into the defcustom
statement generated by define-minor-mode.

Of course, I could also do it manually, as follows:

* Change the :set arg for the current defcustom utf-translate-cjk to
  invoke utf-translate-cjk-mode, instead of the current code.

* Write a new function utf-translate-cjk-mode that does what the
  current lambda expression for :set does.

But what's the point of a convenience macro like define-minor-mode
when I circumvent it?
-- 
A preposition is not a good thing to end a sentence with.

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-23 10:50       ` Kai Großjohann
@ 2003-03-24 15:30         ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2003-03-24 15:30 UTC (permalink / raw)
  Cc: emacs-devel

> I was confused by the following bit of code in define-minor-mode:
> 
>     ;; Check keys.
>     (while (keywordp (car body))
>       (case (pop body)
> 	(:init-value (setq init-value (pop body)))
> 	(:lighter (setq lighter (pop body)))
> 	(:global (setq globalp (pop body)))
> 	(:extra-args (setq extra-args (pop body)))
> 	(:group (setq group (nconc group (list :group (pop body)))))
> 	(:require (setq require (pop body)))
> 	(t (pop body))))
> 
> It seemed to me that the `t' case just throws away the keyword and its arg.

That's the RC code.  The trunk code is different.


	Stefan

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-23 10:56       ` Kai Großjohann
@ 2003-03-24 19:27         ` Richard Stallman
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Stallman @ 2003-03-24 19:27 UTC (permalink / raw)
  Cc: emacs-devel

    The defcustom for utf-translate-cjk contains several keyword args:
    :set, :version, :type, :set-after, and :group.  define-minor-mode is
    a macro that expands to a defcustom statement.  I couldn't see how to
    inject the :version and :set-after keywords into the defcustom
    statement generated by define-minor-mode.

I see now.  I gues adding them to define-minor-mode is ok.

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

* Re: utf-translate-cjk only settable via Customize
  2003-03-10 14:49 utf-translate-cjk only settable via Customize Kai Großjohann
  2003-03-11 20:04 ` Stefan Monnier
@ 2003-03-29 17:46 ` Kai Großjohann
  1 sibling, 0 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-03-29 17:46 UTC (permalink / raw)


kai.grossjohann@uni-duisburg.de (Kai Großjohann) writes:

> Should a function for setting the variable be created?

As Stefan suggested, I've now made it into a (global) minor mode.
-- 
A preposition is not a good thing to end a sentence with.

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

end of thread, other threads:[~2003-03-29 17:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-10 14:49 utf-translate-cjk only settable via Customize Kai Großjohann
2003-03-11 20:04 ` Stefan Monnier
2003-03-17 14:06   ` Kai Großjohann
2003-03-22 21:38     ` Stefan Monnier
2003-03-23 10:50       ` Kai Großjohann
2003-03-24 15:30         ` Stefan Monnier
2003-03-23  2:52     ` Richard Stallman
2003-03-23 10:56       ` Kai Großjohann
2003-03-24 19:27         ` Richard Stallman
2003-03-29 17:46 ` Kai Großjohann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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