unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Replacement for C-x 8 based on input methods
@ 2002-05-14 15:17 Kai Großjohann
  2002-05-14 15:38 ` Miles Bader
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Großjohann @ 2002-05-14 15:17 UTC (permalink / raw)


Thanks to Miles Bader I've now got something which can show how the
C-x 8 replacement could in principle work.  Todo:

* Make an input method (or several input methods) which are
  appropriate for this application.  It might be useful to construct
  an input method by computing the union of several other input
  methods (such as latin-1-prefix and latin-1-postfix).

* Put more features in it.  Maybe a prefix arg could ask the user for
  an input method to use for just the next C-x 8 command?

Do you think that this goes in the right direction?

kai
-- 
Silence is foo!

;;; c-x-9.el --- Like C-x 8 but with input method

;; Copyright (C) 2002  Free Software Foundation, Inc.

;; Author: Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
;; Keywords: i18n, languages

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; This file is a demonstration of what a replacement of C-x 8 could
;; look like.  It would be more useful if there was an input method
;; especially designed for this.  Thanks a lot to Miles Bader for the
;; meat of the function.

;;; Variables:

(require 'cus-edit)

(defcustom secondary-input-method "latin-1-postfix"
  "For `C-x 9'."
  :group 'mule
  :type '(choice (const nil) string))

;;; Code:

(defun insert-with-secondary-input-method ()
  "Insert a character using the secondary input method."
  (interactive)
  (let ((old-method current-input-method))
    (unwind-protect
	(progn
	  (activate-input-method secondary-input-method)
	  (insert (apply 'string
			 (funcall input-method-function
				  (read-char
				   (format "Insert char using %s: "
					   secondary-input-method))))))
      (if old-method
	  (activate-input-method old-method)
	(inactivate-input-method)))))

(global-set-key (kbd "C-x 9") 'insert-with-secondary-input-method)

(provide 'c-x-9)
;;; c-x-9.el ends here

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

end of thread, other threads:[~2002-05-16  7:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-14 15:17 Replacement for C-x 8 based on input methods Kai Großjohann
2002-05-14 15:38 ` Miles Bader
2002-05-14 16:11   ` Kai Großjohann
2002-05-14 23:31     ` Miles Bader
2002-05-15  1:21     ` Miles Bader
2002-05-16  7:21     ` Richard Stallman

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