all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* keyboard macro
@ 2010-05-28  8:05 Kanhaiya
  0 siblings, 0 replies; 9+ messages in thread
From: Kanhaiya @ 2010-05-28  8:05 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Hi

Anyone can tell me that why string not appears as selected when i use a keyboard macro.
This macro contains 'query-replace-regex "<qry [^>]+>.+</qry>' and binded with key 'C+f1'.
But while running C+f1 in file, text not got selected but it reaches at the point of ending </qry>.

I need that text should be in selected mode where user can press 'y' or 'no' or '!' for replacement.

Kanhaiya

[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

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

* keyboard macro
@ 2013-10-21 16:35 Christof Spitz
  2013-10-21 17:26 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Christof Spitz @ 2013-10-21 16:35 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I have to write special characters for transliteration of a non-european
language (devanagari) in Emacs. These include characters like ā,ī,ū,ś,ṣ etc.
Basically this has become easy since Emacs supports Unicode. The question is how
to enter those special characters easily. In Windows, I use a scripting program
called "AutoHotKey". I defined macros so that, for example, when I write "..a"
it will insert "ā" etc. In Emacs, I was not able to define such macros. I have
to use the "function keys" such as f5, or Ctrl or Alt (Meta), so that I have to
enter f5-a to produce ā, for example. That makes the typewriting slow. If I
define a macro instead, it needs to finish the string "..a" with a space to
"trigger" the insert, but this is not what I want.

So my question: Is there a way to define a macro/keyboard function that will
insert a certain character at the point when I write "..x" (not followed by a
space)?

Or should I better look for a Linux scripting program that works similar to
AutoHotKey in Windows?

Thanks for any hints,
Christof

--

Christof Spitz
Opitzstr. 6a
22301 Hamburg
phone +49 40 38636135
mobile +49 172 9008988


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

* Re: keyboard macro
       [not found] <mailman.4404.1382373480.10748.help-gnu-emacs@gnu.org>
@ 2013-10-21 17:00 ` Rustom Mody
  2013-10-21 17:59   ` Christof Spitz
  2013-10-22 17:38 ` Rustom Mody
  1 sibling, 1 reply; 9+ messages in thread
From: Rustom Mody @ 2013-10-21 17:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, October 21, 2013 10:05:51 PM UTC+5:30, Christof Spitz wrote:
> Hello,
> 
> 
> 
> I have to write special characters for transliteration of a non-european
> language (devanagari) in Emacs. These include characters like ā,ī,ū,ś,ṣ etc.
> Basically this has become easy since Emacs supports Unicode. The question is how
> to enter those special characters easily. In Windows, I use a scripting program
> called "AutoHotKey". I defined macros so that, for example, when I write "..a"
> it will insert "ā" etc. In Emacs, I was not able to define such macros. I have
> 
> to use the "function keys" such as f5, or Ctrl or Alt (Meta), so that I have to
> enter f5-a to produce ā, for example. That makes the typewriting slow. If I
> define a macro instead, it needs to finish the string "..a" with a space to
> "trigger" the insert, but this is not what I want.
> 
> 
> So my question: Is there a way to define a macro/keyboard function that will
> insert a certain character at the point when I write "..x" (not followed by a
> space)?
> 
> 
> Or should I better look for a Linux scripting program that works similar to
> AutoHotKey in Windows?
> 

After evaluating the below code, do C-x RET C-\ diacritic-for-devanagari
--------------------
(require 'quail)

(quail-define-package
 "diacritic-for-devanagari" "UTF-8" "अ" t
 "Example diacritic

" nil t t nil t nil nil nil nil nil t)

(quail-define-rules
 ("..a" ?ā)
 ;; add the rest here
)



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

* Re: keyboard macro
  2013-10-21 16:35 Christof Spitz
@ 2013-10-21 17:26 ` Stefan Monnier
       [not found] ` <mailman.4410.1382376390.10748.help-gnu-emacs@gnu.org>
  2013-10-21 18:17 ` Yuri Khan
  2 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2013-10-21 17:26 UTC (permalink / raw)
  To: help-gnu-emacs

> So my question: Is there a way to define a macro/keyboard function that will
> insert a certain character at the point when I write "..x" (not followed by a
> space)?

Not exactly, tho you could cook one up.  E.g. (guaranteed 100% untested):

   (defvar my-magic-rewrites
     '(
       ("..a" . "ā")
      ))
   
   (defvar my-last-chars nil)

   (defun my-p-s-i-h ()
     (unless (eq last-command this-command)
       (setq my-last-chars ""))
     (setq my-last-chars (concat my-last-chars (string last-command-event)))
     (let ((rewrite (assoc my-last-chars my-magic-rewrites)))
       (when rewrite
         (delete-char (- (length (car rewrite))))
         (insert (cdr rewrite)))))
   (add-hook 'post-self-insert-hook #'my-p-s-i-h)

But I recommend you try instead M-x describe-input-method RET devana TAB


        Stefan




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

* Re: keyboard macro
       [not found] ` <mailman.4410.1382376390.10748.help-gnu-emacs@gnu.org>
@ 2013-10-21 17:39   ` Rustom Mody
  0 siblings, 0 replies; 9+ messages in thread
From: Rustom Mody @ 2013-10-21 17:39 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, October 21, 2013 10:56:02 PM UTC+5:30, Stefan Monnier wrote:
> 
> But I recommend you try instead M-x describe-input-method RET devana TAB

I only see itrans inscript kyoto and aiba -- all of which enter devanagari with some variations in the latin (ASCII-keys) used to enter.  ie none of them have outputs as latin-with-diacritics. latin-1-prefix (or postfix) seems more appropriate however it does not seem to have macrons

As for my suggestion, I cannot say I really understand it especially all the parameters.  David de la Harpe Golden showed it to me in some other context and I just tailored it to make it work for you.


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

* Re: keyboard macro
  2013-10-21 17:00 ` Rustom Mody
@ 2013-10-21 17:59   ` Christof Spitz
  0 siblings, 0 replies; 9+ messages in thread
From: Christof Spitz @ 2013-10-21 17:59 UTC (permalink / raw)
  To: help-gnu-emacs, Rustom Mody

Wow, thanks so much, Rustom, works great!!

Christof

> Rustom Mody <rustompmody@gmail.com> hat am 21. Oktober 2013 um 19:00
> geschrieben:
>
>
> On Monday, October 21, 2013 10:05:51 PM UTC+5:30, Christof Spitz wrote:
> > Hello,
> >
> >
> >
> > I have to write special characters for transliteration of a non-european
> > language (devanagari) in Emacs. These include characters like ā,ī,ū,ś,ṣ etc.
> > Basically this has become easy since Emacs supports Unicode. The question is
> > how
> > to enter those special characters easily. In Windows, I use a scripting
> > program
> > called "AutoHotKey". I defined macros so that, for example, when I write
> > "..a"
> > it will insert "ā" etc. In Emacs, I was not able to define such macros. I
> > have
> >
> > to use the "function keys" such as f5, or Ctrl or Alt (Meta), so that I have
> > to
> > enter f5-a to produce ā, for example. That makes the typewriting slow. If I
> > define a macro instead, it needs to finish the string "..a" with a space to
> > "trigger" the insert, but this is not what I want.
> >
> >
> > So my question: Is there a way to define a macro/keyboard function that will
> > insert a certain character at the point when I write "..x" (not followed by
> > a
> > space)?
> >
> >
> > Or should I better look for a Linux scripting program that works similar to
> > AutoHotKey in Windows?
> >
>
> After evaluating the below code, do C-x RET C-\ diacritic-for-devanagari
> --------------------
> (require 'quail)
>
> (quail-define-package
> "diacritic-for-devanagari" "UTF-8" "अ" t
> "Example diacritic
>
> " nil t t nil t nil nil nil nil nil t)
>
> (quail-define-rules
> ("..a" ?ā)
> ;; add the rest here
> )
>
>
--

Christof Spitz
Opitzstr. 6a
22301 Hamburg
phone +49 40 38636135
mobile +49 172 9008988


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

* Re: keyboard macro
  2013-10-21 16:35 Christof Spitz
  2013-10-21 17:26 ` Stefan Monnier
       [not found] ` <mailman.4410.1382376390.10748.help-gnu-emacs@gnu.org>
@ 2013-10-21 18:17 ` Yuri Khan
  2013-10-21 18:25   ` Yuri Khan
  2 siblings, 1 reply; 9+ messages in thread
From: Yuri Khan @ 2013-10-21 18:17 UTC (permalink / raw)
  To: Christof Spitz; +Cc: help-gnu-emacs@gnu.org

On Mon, Oct 21, 2013 at 11:35 PM, Christof Spitz <cs@lotsawa.de> wrote:

> I have to write special characters for transliteration of a non-european
> language (devanagari) in Emacs. These include characters like ā,ī,ū,ś,ṣ etc.
> Basically this has become easy since Emacs supports Unicode. The question is how
> to enter those special characters easily. In Windows, I use a scripting program
> called "AutoHotKey". I defined macros so that, for example, when I write "..a"
> it will insert "ā" etc.

It never ceases to amaze me how far people are willing to go just to
avoid using an appropriate OS-level keyboard layout. In your case,
probably, the command “setxkbmap -layout "us,in" -variant ",deva"
-options "grp:caps_toggle,grp_led:caps"” will help a lot.



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

* Re: keyboard macro
  2013-10-21 18:17 ` Yuri Khan
@ 2013-10-21 18:25   ` Yuri Khan
  0 siblings, 0 replies; 9+ messages in thread
From: Yuri Khan @ 2013-10-21 18:25 UTC (permalink / raw)
  To: Christof Spitz; +Cc: help-gnu-emacs@gnu.org

On Tue, Oct 22, 2013 at 1:17 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Mon, Oct 21, 2013 at 11:35 PM, Christof Spitz <cs@lotsawa.de> wrote:
>
>> I have to write special characters for transliteration of a non-european
>> language (devanagari) in Emacs. These include characters like ā,ī,ū,ś,ṣ etc.
>
> It never ceases to amaze me how far people are willing to go just to
> avoid using an appropriate OS-level keyboard layout. In your case,
> probably, the command “setxkbmap -layout "us,in" -variant ",deva"
> -options "grp:caps_toggle,grp_led:caps"” will help a lot.

On second reading, you want a transliteration, not real devanagari. In
that case, you can create your own transliterated layout by cloning
the /usr/share/X11/xkb/symbols/in file and substituting your preferred
code points. (You will also need to add lines to the rules/evdev
file.)

Alternatively, hack the Latin-based layout of your choice to include
the diacritics you need, either as dead keys or as combining
characters.



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

* Re: keyboard macro
       [not found] <mailman.4404.1382373480.10748.help-gnu-emacs@gnu.org>
  2013-10-21 17:00 ` Rustom Mody
@ 2013-10-22 17:38 ` Rustom Mody
  1 sibling, 0 replies; 9+ messages in thread
From: Rustom Mody @ 2013-10-22 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, October 21, 2013 10:05:51 PM UTC+5:30, Christof Spitz wrote:
> Hello,
> 
> I have to write special characters for transliteration of a non-european
> 
> language (devanagari) in Emacs. These include characters like ā,ī,ū,ś,ṣ etc.


Can you try this?  It uses Itrans scheme

(require 'quail)

(quail-define-package
 "devanagari-diacritic" "UTF-8" "अ" t
 "Example diacritic

" nil t t nil t nil nil nil nil nil t)

(defvar devanagari-map
  '(("A"  ?ā)
    ("I"  ?ī)
    ("U"  ?ū)
    ("~N" ?ṅ)
    ("~n" ?ñ)
    ("N"  ?ṇ)
    ("T"  ?ṭ)
    ("D"  ?ḍ)
    ("sh" ?ś)
    ("Sh" ?ṣ)
))

(defun quail-block-defrules (kb quail-package)
  (dolist (key-trans devanagari-map)
    (let ((key (car key-trans))
      (trans (cadr key-trans)))
      (quail-defrule key trans quail-package))))

(quail-block-defrules devanagari-map "devanagari-diacritic")


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

end of thread, other threads:[~2013-10-22 17:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-28  8:05 keyboard macro Kanhaiya
  -- strict thread matches above, loose matches on Subject: below --
2013-10-21 16:35 Christof Spitz
2013-10-21 17:26 ` Stefan Monnier
     [not found] ` <mailman.4410.1382376390.10748.help-gnu-emacs@gnu.org>
2013-10-21 17:39   ` Rustom Mody
2013-10-21 18:17 ` Yuri Khan
2013-10-21 18:25   ` Yuri Khan
     [not found] <mailman.4404.1382373480.10748.help-gnu-emacs@gnu.org>
2013-10-21 17:00 ` Rustom Mody
2013-10-21 17:59   ` Christof Spitz
2013-10-22 17:38 ` Rustom Mody

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.