* Re: smartquotes.el -- Insertion of unicode quotes in text documents
[not found] <1b151690708252221j7177cea1xe8916c52a1110190@mail.gmail.com>
@ 2007-08-26 22:47 ` Richard Stallman
2007-08-27 4:46 ` Martin Blais
2007-08-27 5:08 ` David Kastrup
0 siblings, 2 replies; 12+ messages in thread
From: Richard Stallman @ 2007-08-26 22:47 UTC (permalink / raw)
To: Martin Blais, handa; +Cc: emacs-devel
;; - C-" inserts then cycles through the fancier double quotes;
;; - C-' inserts then cycles through the fancier single quotes;
;; - Inserting four dots inserts an ellipsis character. Inserting an additional
;; fourth dot resumes with a string of dots;
;; - Inserting four hyphens inserts an mdash (a long dash character), then an
;; ndash (an inter-word dash character), and then resumes with a string of
;; normal hyphens.
I can see why it is useful, but we already have a similar facility:
Quail. What about using Quail for this?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-26 22:47 ` smartquotes.el -- Insertion of unicode quotes in text documents Richard Stallman
@ 2007-08-27 4:46 ` Martin Blais
[not found] ` <E1IPj9g-0003Zm-8v@fencepost.gnu.org>
2007-08-27 5:08 ` David Kastrup
1 sibling, 1 reply; 12+ messages in thread
From: Martin Blais @ 2007-08-27 4:46 UTC (permalink / raw)
To: rms; +Cc: emacs-devel, handa
On 8/26/07, Richard Stallman <rms@gnu.org> wrote:
> ;; - C-" inserts then cycles through the fancier double quotes;
>
> ;; - C-' inserts then cycles through the fancier single quotes;
>
> ;; - Inserting four dots inserts an ellipsis character. Inserting an additional
> ;; fourth dot resumes with a string of dots;
>
> ;; - Inserting four hyphens inserts an mdash (a long dash character), then an
> ;; ndash (an inter-word dash character), and then resumes with a string of
> ;; normal hyphens.
>
> I can see why it is useful, but we already have a similar facility:
> Quail. What about using Quail for this?
Hi Richard
I fail to see how Quail can be used to do what smartquotes.el does.
1. I need special bindings for the fancy quotes and double quotes
2. I'm modifying the meanings of . and - (I don't know how to do this
with Quail)
Sometimes it takes less effort to write something simple for yourself
than to learn something more complex. In this case, I simply did not
remember or know Quail enough to check it out first (I will).
Bisous,
PS I still did not find time to clean up rst.el to send you the final
version for inclusion... it's still on my list.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-26 22:47 ` smartquotes.el -- Insertion of unicode quotes in text documents Richard Stallman
2007-08-27 4:46 ` Martin Blais
@ 2007-08-27 5:08 ` David Kastrup
2007-08-27 21:16 ` Composition of Quail IMs (was: smartquotes.el -- Insertion of unicode quotes in text documents) Stefan Monnier
1 sibling, 1 reply; 12+ messages in thread
From: David Kastrup @ 2007-08-27 5:08 UTC (permalink / raw)
To: rms; +Cc: Martin Blais, emacs-devel, handa
Richard Stallman <rms@gnu.org> writes:
> ;; - C-" inserts then cycles through the fancier double quotes;
>
> ;; - C-' inserts then cycles through the fancier single quotes;
>
> ;; - Inserting four dots inserts an ellipsis character. Inserting an additional
> ;; fourth dot resumes with a string of dots;
>
> ;; - Inserting four hyphens inserts an mdash (a long dash character), then an
> ;; ndash (an inter-word dash character), and then resumes with a string of
> ;; normal hyphens.
>
> I can see why it is useful, but we already have a similar facility:
> Quail. What about using Quail for this?
Can Quail support multiple input methods at once? Because it would be
inconvenient to be able to use such a feature only when no other input
method is used.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
[not found] ` <E1IPj9g-0003Zm-8v@fencepost.gnu.org>
@ 2007-08-27 18:53 ` David Kastrup
[not found] ` <E1IQ3Hl-0008FI-LE@fencepost.gnu.org>
0 siblings, 1 reply; 12+ messages in thread
From: David Kastrup @ 2007-08-27 18:53 UTC (permalink / raw)
To: rms; +Cc: Martin Blais, handa, emacs-devel
Richard Stallman <rms@gnu.org> writes:
> I fail to see how Quail can be used to do what smartquotes.el does.
>
> It ought to be able to translate sequences of periods and hyphens
> into other text. And it could have another similar mechanism for
> entering the various kinds of quotations.
>
> I am not saying I am sure this is better than your approach. But it
> has the advantage of being more coherent with the rest of Emacs,
> i.e., not being another ad hoc feature. We should not adopt the ad
> hoc approach without giving this one a try too.
I think this might need a way to have several Quail methods active at
once. I have considered using Quail for some things in AUCTeX, but
not being able to use other input methods at the same time is a
showstopper.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 12+ messages in thread
* Composition of Quail IMs (was: smartquotes.el -- Insertion of unicode quotes in text documents)
2007-08-27 5:08 ` David Kastrup
@ 2007-08-27 21:16 ` Stefan Monnier
0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2007-08-27 21:16 UTC (permalink / raw)
To: David Kastrup; +Cc: Martin Blais, handa, rms, emacs-devel
>> I can see why it is useful, but we already have a similar facility:
>> Quail. What about using Quail for this?
> Can Quail support multiple input methods at once? Because it would be
> inconvenient to be able to use such a feature only when no other input
> method is used.
Indeed, it currently cannot. And it's a good reason not to use quail for
this package. The problem showed up a few years ago already (probably when
discussing something around C-x 8 which should really be a combination of
quail's latin-1postfix and latin-1-prefix, shifted to the C-x 8 prefix) and
I wrote a naive proof of concept:
(defun quail-merge-maps (map1 &rest maps)
(if (null maps) map1
(let* ((map2 (pop maps))
(h1 (pop map1))
(h2 (pop map2)))
(apply 'quail-merge-maps
(cons
(if (and h1 h2)
(vconcat (if (vectorp h1) h1 (vector h1))
(if (vectorp h2) h2 (vector h2)))
(or h1 h2))
(let ((tail nil) conflict)
(dolist (entry map1)
(setq conflict (assq (car entry) map2))
(push (if (not conflict) entry
(setq map2 (delq conflict map2))
(cons (car entry)
(quail-merge-maps (cdr entry) (cdr conflict))))
tail))
(append map2 tail)))
maps))))
but I don't know and understand enough of Quail's facilities to be able to
make this work reliably even for complex input methods.
I think compositionality of Quail input methods would be a great
improvement, but I don't think I'm up to doing it,
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
[not found] ` <E1IQ3Hl-0008FI-LE@fencepost.gnu.org>
@ 2007-08-30 8:12 ` Kenichi Handa
2007-08-30 8:29 ` David Kastrup
2007-08-31 7:35 ` Richard Stallman
0 siblings, 2 replies; 12+ messages in thread
From: Kenichi Handa @ 2007-08-30 8:12 UTC (permalink / raw)
To: rms; +Cc: blais, emacs-devel
In article <E1IQ3Hl-0008FI-LE@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> I think this might need a way to have several Quail methods active at
> once.
> You may be right. Handa-san, can you implement that easily?
Activating multiple input methods itself won't be that
difficult, but there are many subtle matters to be solved.
What kind of user interface should be provided for
activating and deactivating multiple input methods?
What to do for C-h C-\?
What to show in the modeline?
etc.
I need more time to consider it.
By the way, merging multiple quail maps is the different
thing, and is very difficult considering the current
stracture of a quail map.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-30 8:12 ` Kenichi Handa
@ 2007-08-30 8:29 ` David Kastrup
2007-08-30 11:46 ` Kenichi Handa
2007-08-31 7:35 ` Richard Stallman
1 sibling, 1 reply; 12+ messages in thread
From: David Kastrup @ 2007-08-30 8:29 UTC (permalink / raw)
To: Kenichi Handa; +Cc: blais, rms, emacs-devel
Kenichi Handa <handa@m17n.org> writes:
> In article <E1IQ3Hl-0008FI-LE@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
>
>> I think this might need a way to have several Quail methods active at
>> once.
>
>> You may be right. Handa-san, can you implement that easily?
>
> Activating multiple input methods itself won't be that
> difficult, but there are many subtle matters to be solved.
>
> What kind of user interface should be provided for
> activating and deactivating multiple input methods?
> What to do for C-h C-\?
> What to show in the modeline?
> etc.
I think that we should distinguish between user-visible
language-related input methods, and the quail mechanism being
available to minor modes internally.
The relation is similar between major and minor buffer modes: while
you usually don't have more than one major mode active, minor modes
are on _top_ of that, and often multiple such modes make sense.
--
David Kastrup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-30 8:29 ` David Kastrup
@ 2007-08-30 11:46 ` Kenichi Handa
2007-08-30 12:32 ` David Kastrup
2007-08-31 7:36 ` Richard Stallman
0 siblings, 2 replies; 12+ messages in thread
From: Kenichi Handa @ 2007-08-30 11:46 UTC (permalink / raw)
To: David Kastrup; +Cc: blais, rms, emacs-devel
In article <86abs9juh5.fsf@lola.quinscape.zz>, David Kastrup <dak@gnu.org> writes:
> Kenichi Handa <handa@m17n.org> writes:
> > In article <E1IQ3Hl-0008FI-LE@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> >
>>> I think this might need a way to have several Quail methods active at
once.
> >
>>> You may be right. Handa-san, can you implement that easily?
> >
> > Activating multiple input methods itself won't be that
> > difficult, but there are many subtle matters to be solved.
> >
> > What kind of user interface should be provided for
> > activating and deactivating multiple input methods?
> > What to do for C-h C-\?
> > What to show in the modeline?
> > etc.
> I think that we should distinguish between user-visible
> language-related input methods, and the quail mechanism being
> available to minor modes internally.
> The relation is similar between major and minor buffer modes: while
> you usually don't have more than one major mode active, minor modes
> are on _top_ of that, and often multiple such modes make sense.
I'm not sure it is good to associate input methods with a
minor mode. We may have to have stacked input methods, and
turn on and off them at once.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-30 11:46 ` Kenichi Handa
@ 2007-08-30 12:32 ` David Kastrup
2007-08-31 7:36 ` Richard Stallman
1 sibling, 0 replies; 12+ messages in thread
From: David Kastrup @ 2007-08-30 12:32 UTC (permalink / raw)
To: Kenichi Handa; +Cc: blais, rms, emacs-devel
Kenichi Handa <handa@m17n.org> writes:
> In article <86abs9juh5.fsf@lola.quinscape.zz>, David Kastrup <dak@gnu.org> writes:
>
>> I think that we should distinguish between user-visible
>> language-related input methods, and the quail mechanism being
>> available to minor modes internally.
>
>> The relation is similar between major and minor buffer modes: while
>> you usually don't have more than one major mode active, minor modes
>> are on _top_ of that, and often multiple such modes make sense.
>
> I'm not sure it is good to associate input methods with a
> minor mode. We may have to have stacked input methods, and
> turn on and off them at once.
AUCTeX has something like LaTeX-math-mode (a proper minor mode) which
offers shortcuts for inputting math macros. It also has some magic
surrounding various dash and quote combinations depending on Babel
package options (those don't form or warrant minor modes).
Having those work in read-string calls with INHERIT-INPUT-METHOD set
would be quite less surprising to the user.
--
David Kastrup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-30 8:12 ` Kenichi Handa
2007-08-30 8:29 ` David Kastrup
@ 2007-08-31 7:35 ` Richard Stallman
2007-09-04 6:48 ` Kenichi Handa
1 sibling, 1 reply; 12+ messages in thread
From: Richard Stallman @ 2007-08-31 7:35 UTC (permalink / raw)
To: Kenichi Handa; +Cc: blais, emacs-devel
What kind of user interface should be provided for
activating and deactivating multiple input methods?
Here's one idea: the user enables and disables one input method,
directly, and the others are enabled or disabled by a Lisp interface.
That Lisp interface can be called by other commands.
Does this solve that one problem?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-30 11:46 ` Kenichi Handa
2007-08-30 12:32 ` David Kastrup
@ 2007-08-31 7:36 ` Richard Stallman
1 sibling, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2007-08-31 7:36 UTC (permalink / raw)
To: Kenichi Handa; +Cc: blais, emacs-devel
I'm not sure it is good to associate input methods with a
minor mode. We may have to have stacked input methods, and
turn on and off them at once.
That stack limitation would not be a good thing, and I am sure
it is possible to avoid it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: smartquotes.el -- Insertion of unicode quotes in text documents
2007-08-31 7:35 ` Richard Stallman
@ 2007-09-04 6:48 ` Kenichi Handa
0 siblings, 0 replies; 12+ messages in thread
From: Kenichi Handa @ 2007-09-04 6:48 UTC (permalink / raw)
To: rms; +Cc: blais, emacs-devel
In article <E1IR12U-0000a1-Fv@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> What kind of user interface should be provided for
> activating and deactivating multiple input methods?
> Here's one idea: the user enables and disables one input method,
> directly, and the others are enabled or disabled by a Lisp interface.
> That Lisp interface can be called by other commands.
> Does this solve that one problem?
Yes. I implemented it as an add-on code (with a little bit
tricky way). Once it is found that it works well, I'll
merge the code into mule-cmds.el while cleaning the code.
Please try the attached code with the latest
emacs-unicode-2. The Lisp interfaces are the functions
activate-preposition-input-method and
inactivate-preposition-input-method.
---
Kenichi Handa
handa@m17n.org
(defvar local-input-method-list nil
"List of local preposition input methods.")
(make-variable-buffer-local 'local-input-method-list)
(defvar global-input-method-list nil
"List of global preposition input methods.")
(defvar normal-input-method nil
"Currently active normal (i.e. non-preposion) input method.")
(defun multi-input-method-function (event)
"Input method function used while some preposition input method is active."
(let ((disable-input-method-hook t)
unread-command-events)
(dolist (elt (append global-input-method-list
local-input-method-list))
(let (input-method-history default-input-method)
(activate-input-method elt)
(setq unread-command-events
(nreverse (funcall input-method-function event)))
(setq event (car unread-command-events)
unread-command-events (cdr unread-command-events))))
(let (input-method-history)
(inactivate-input-method))
(setq current-input-method nil
current-input-method-title nil)
(unwind-protect
(if normal-input-method
(progn
(activate-input-method normal-input-method)
(append (funcall input-method-function event)
unread-command-events))
(cons event unread-command-events))
(setq input-method-function 'multi-input-method-function))))
;; If non-nil, disable input-method-hook.
(defvar disable-input-method-hook nil)
;; A function for input-method-active-hook used while some preposition
;; input method is active.
(defun input-method-activate-hook ()
(unless disable-input-method-hook
(setq normal-input-method current-input-method)
(if (or local-input-method-list global-input-method-list)
(setq input-method-function 'multi-input-method-function))))
;; A function for input-method-inactivate-hook used while some
;; preposition input method is active.
(defun input-method-inactivate-hook ()
(unless disable-input-method-hook
(setq normal-input-method nil)
(if (or local-input-method-list global-input-method-list)
(setq input-method-function 'multi-input-method-function))))
(defun activate-preposition-input-method (input-method global)
"Activate a preposition INPUT-METHOD.
INPUT-METHOD is handled before a normal input method.
If the second arg GLOBAL is non-nil, activate it for all buffers.
Otherwise, activate it only for the current buffer."
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(or (assoc input-method input-method-alist)
(error "Unknown input method: %s" input-method))
(unless (assoc-string input-method
(if global global-input-method-list
local-input-method-list))
(or global-input-method-list
local-input-method-list
(progn
(add-hook 'input-method-activate-hook
'input-method-activate-hook)
(add-hook 'input-method-inactivate-hook
'input-method-inactivate-hook)))
(setq normal-input-method current-input-method)
(if global
(progn
(push input-method global-input-method-list)
(setq-default input-method-function 'multi-input-method-function))
(push input-method local-input-method-list))
(make-local-variable 'input-method-function)
(setq input-method-function 'multi-input-method-function)))
(defun inactivate-preposition-input-method (input-method global)
"Inactivate a proposition INPUT-METHOD.
If the second arg GLOBAL is non-nil, inactivate it for all buffers.
Otherwise, inactivate it only for the curren buffer."
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(if global
(setq global-input-method-list
(delete input-method global-input-method-list))
(setq local-input-method-list
(delete input-method local-input-method-list)))
(or global-input-method-list
local-input-method-list
(progn
(remove-hook 'input-method-activate-hook
'input-method-activate-hook)
(remove-hook 'input-method-inactivate-hook
'input-method-inactivate-hook)
(setq input-method-function nil)
(when normal-input-method
(inactivate-input-method)
(activate-input-method normal-input-method)))))
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-09-04 6:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1b151690708252221j7177cea1xe8916c52a1110190@mail.gmail.com>
2007-08-26 22:47 ` smartquotes.el -- Insertion of unicode quotes in text documents Richard Stallman
2007-08-27 4:46 ` Martin Blais
[not found] ` <E1IPj9g-0003Zm-8v@fencepost.gnu.org>
2007-08-27 18:53 ` David Kastrup
[not found] ` <E1IQ3Hl-0008FI-LE@fencepost.gnu.org>
2007-08-30 8:12 ` Kenichi Handa
2007-08-30 8:29 ` David Kastrup
2007-08-30 11:46 ` Kenichi Handa
2007-08-30 12:32 ` David Kastrup
2007-08-31 7:36 ` Richard Stallman
2007-08-31 7:35 ` Richard Stallman
2007-09-04 6:48 ` Kenichi Handa
2007-08-27 5:08 ` David Kastrup
2007-08-27 21:16 ` Composition of Quail IMs (was: smartquotes.el -- Insertion of unicode quotes in text documents) Stefan Monnier
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.