diff options
| author | Kenichi Handa | 2010-01-14 12:44:36 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-01-14 12:44:36 +0900 |
| commit | d9a7c14092befb75995e75dc66d050af514443e6 (patch) | |
| tree | 08ac48393db87e623233cf089ef0f72474ae4fea | |
| parent | d1bf28dc12ef1a0f3cecbf78f38795db27b38574 (diff) | |
| download | emacs-d9a7c14092befb75995e75dc66d050af514443e6.tar.gz emacs-d9a7c14092befb75995e75dc66d050af514443e6.zip | |
Make auto-composition work on all buffers even if they are fundamental mode.
| -rw-r--r-- | etc/ChangeLog | 4 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/composite.el | 42 | ||||
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/composite.c | 12 |
6 files changed, 61 insertions, 25 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog index d2ee1bd034c..fc6da640915 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2010-01-14 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * NEWS: Describe the change of auto-composition-mode. | ||
| 4 | |||
| 1 | 2010-01-12 Glenn Morris <rgm@gnu.org> | 5 | 2010-01-12 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * CONTRIBUTE, NEWS: Use bug-gnu-emacs rather than emacs-pretest-bug | 7 | * CONTRIBUTE, NEWS: Use bug-gnu-emacs rather than emacs-pretest-bug |
| @@ -122,6 +122,11 @@ international/ucs-normalize.el. | |||
| 122 | ** Function arguments in *Help* buffers are now shown in upper-case. | 122 | ** Function arguments in *Help* buffers are now shown in upper-case. |
| 123 | Customize `help-downcase-arguments' to t to show them in lower-case. | 123 | Customize `help-downcase-arguments' to t to show them in lower-case. |
| 124 | 124 | ||
| 125 | ** Delete Auto Composition Mode. Now the variable | ||
| 126 | `auto-composition-mode' is simply a buffer local variable. The | ||
| 127 | commands `auto-composition-mode' and `global-auto-composition-mode' | ||
| 128 | still works as before. | ||
| 129 | |||
| 125 | 130 | ||
| 126 | * Editing Changes in Emacs 23.2 | 131 | * Editing Changes in Emacs 23.2 |
| 127 | 132 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3c95811a8fc..72e25487320 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-01-14 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * composite.el (auto-composition-mode): Make it a buffer local | ||
| 4 | variable (permanent-local). | ||
| 5 | (auto-composition-function): Set the default value to | ||
| 6 | auto-compose-chars. | ||
| 7 | (auto-composition-mode): Make it a simple function, not a minor | ||
| 8 | mode. | ||
| 9 | (global-auto-composition-mode): Likewise. | ||
| 10 | (turn-on-auto-composition-if-enabled): Delete it. | ||
| 11 | |||
| 1 | 2010-01-12 Michael Albinus <michael.albinus@gmx.de> | 12 | 2010-01-12 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 13 | ||
| 3 | * files.el (copy-directory): Compute target for recursive | 14 | * files.el (copy-directory): Compute target for recursive |
diff --git a/lisp/composite.el b/lisp/composite.el index ce7ea95800b..4e91945b1b6 100644 --- a/lisp/composite.el +++ b/lisp/composite.el | |||
| @@ -744,10 +744,14 @@ This function is the default value of `auto-composition-function' (which see)." | |||
| 744 | (setq func 'compose-gstring-for-terminal)) | 744 | (setq func 'compose-gstring-for-terminal)) |
| 745 | (funcall func gstring)))) | 745 | (funcall func gstring)))) |
| 746 | 746 | ||
| 747 | (make-variable-buffer-local 'auto-composition-mode) | ||
| 748 | (put 'auto-composition-mode 'permanent-local t) | ||
| 749 | |||
| 747 | (make-variable-buffer-local 'auto-composition-function) | 750 | (make-variable-buffer-local 'auto-composition-function) |
| 751 | (setq-default auto-composition-function 'auto-compose-chars) | ||
| 748 | 752 | ||
| 749 | ;;;###autoload | 753 | ;;;###autoload |
| 750 | (define-minor-mode auto-composition-mode | 754 | (defun auto-composition-mode (&optional arg) |
| 751 | "Toggle Auto Composition mode. | 755 | "Toggle Auto Composition mode. |
| 752 | With ARG, turn Auto Composition mode off if and only if ARG is a non-positive | 756 | With ARG, turn Auto Composition mode off if and only if ARG is a non-positive |
| 753 | number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto | 757 | number; if ARG is nil, toggle Auto Composition mode; anything else turns Auto |
| @@ -758,29 +762,23 @@ by functions registered in `composition-function-table' (which see). | |||
| 758 | 762 | ||
| 759 | You can use `global-auto-composition-mode' to turn on | 763 | You can use `global-auto-composition-mode' to turn on |
| 760 | Auto Composition mode in all buffers (this is the default)." | 764 | Auto Composition mode in all buffers (this is the default)." |
| 761 | nil nil nil | 765 | (interactive "P") |
| 762 | (if noninteractive | 766 | (setq auto-composition-mode |
| 763 | (setq auto-composition-mode nil)) | 767 | (if arg |
| 764 | (cond (auto-composition-mode | 768 | (or (not (integerp arg)) (> arg 0)) |
| 765 | (setq auto-composition-function 'auto-compose-chars)) | 769 | (not auto-composition-mode)))) |
| 766 | (t | ||
| 767 | (setq auto-composition-function nil)))) | ||
| 768 | |||
| 769 | (defun turn-on-auto-composition-if-enabled () | ||
| 770 | (if enable-multibyte-characters | ||
| 771 | (auto-composition-mode 1))) | ||
| 772 | 770 | ||
| 773 | ;;;###autoload | 771 | ;;;###autoload |
| 774 | (define-global-minor-mode global-auto-composition-mode | 772 | (defun global-auto-composition-mode (&optional arg) |
| 775 | auto-composition-mode turn-on-auto-composition-if-enabled | 773 | "Toggle Auto-Composition mode in every possible buffer. |
| 776 | ;; This :extra-args' appears to be the result of a naive copy&paste | 774 | With prefix arg, turn Global-Auto-Composition mode on if and only if arg |
| 777 | ;; from global-font-lock-mode. | 775 | is positive. |
| 778 | ;; :extra-args (dummy) | 776 | See `auto-composition-mode' for more information on Auto-Composition mode." |
| 779 | :initialize 'custom-initialize-delay | 777 | (interactive "P") |
| 780 | :init-value (not noninteractive) | 778 | (setq-default auto-composition-mode |
| 781 | :group 'auto-composition | 779 | (if arg |
| 782 | :version "23.1") | 780 | (or (not (integerp arg)) (> arg 0)) |
| 783 | 781 | (not (default-value 'auto-composition-mode))))) | |
| 784 | (defalias 'toggle-auto-composition 'auto-composition-mode) | 782 | (defalias 'toggle-auto-composition 'auto-composition-mode) |
| 785 | 783 | ||
| 786 | 784 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 6e3fc4ff1c5..1b382cb5a53 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2010-01-14 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | Make auto-composition work on all buffers even if they are | ||
| 4 | fundamental mode. | ||
| 5 | |||
| 6 | * composite.c (Vauto_composition_mode): New variable. | ||
| 7 | (composition_compute_stop_pos): Check Vauto_composition_mode | ||
| 8 | instead of Vauto_composition_function. | ||
| 9 | (composition_adjust_point, Ffind_composition_internal): Likewise. | ||
| 10 | (syms_of_composite): Declare Lisp variable | ||
| 11 | "auto-composition-mode" here. | ||
| 12 | |||
| 1 | 2010-01-13 Kenichi Handa <handa@m17n.org> | 13 | 2010-01-13 Kenichi Handa <handa@m17n.org> |
| 2 | 14 | ||
| 3 | Display buffer name, etc. in mode line by composing correctly. | 15 | Display buffer name, etc. in mode line by composing correctly. |
diff --git a/src/composite.c b/src/composite.c index edebf1e3136..3c2bf409eed 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -157,6 +157,7 @@ Lisp_Object composition_hash_table; | |||
| 157 | Lisp_Object Vcompose_chars_after_function; | 157 | Lisp_Object Vcompose_chars_after_function; |
| 158 | 158 | ||
| 159 | Lisp_Object Qauto_composed; | 159 | Lisp_Object Qauto_composed; |
| 160 | Lisp_Object Vauto_composition_mode; | ||
| 160 | Lisp_Object Vauto_composition_function; | 161 | Lisp_Object Vauto_composition_function; |
| 161 | Lisp_Object Qauto_composition_function; | 162 | Lisp_Object Qauto_composition_function; |
| 162 | Lisp_Object Vcomposition_function_table; | 163 | Lisp_Object Vcomposition_function_table; |
| @@ -1039,7 +1040,7 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 1039 | if (NILP (string) && PT > charpos && PT < endpos) | 1040 | if (NILP (string) && PT > charpos && PT < endpos) |
| 1040 | cmp_it->stop_pos = PT; | 1041 | cmp_it->stop_pos = PT; |
| 1041 | if (NILP (current_buffer->enable_multibyte_characters) | 1042 | if (NILP (current_buffer->enable_multibyte_characters) |
| 1042 | || ! FUNCTIONP (Vauto_composition_function)) | 1043 | || NILP (Vauto_composition_mode)) |
| 1043 | return; | 1044 | return; |
| 1044 | if (bytepos < 0) | 1045 | if (bytepos < 0) |
| 1045 | { | 1046 | { |
| @@ -1478,7 +1479,7 @@ composition_adjust_point (last_pt, new_pt) | |||
| 1478 | } | 1479 | } |
| 1479 | 1480 | ||
| 1480 | if (NILP (current_buffer->enable_multibyte_characters) | 1481 | if (NILP (current_buffer->enable_multibyte_characters) |
| 1481 | || ! FUNCTIONP (Vauto_composition_function)) | 1482 | || NILP (Vauto_composition_mode)) |
| 1482 | return new_pt; | 1483 | return new_pt; |
| 1483 | 1484 | ||
| 1484 | /* Next check the automatic composition. */ | 1485 | /* Next check the automatic composition. */ |
| @@ -1661,7 +1662,7 @@ See `find-composition' for more details. */) | |||
| 1661 | if (!find_composition (from, to, &start, &end, &prop, string)) | 1662 | if (!find_composition (from, to, &start, &end, &prop, string)) |
| 1662 | { | 1663 | { |
| 1663 | if (!NILP (current_buffer->enable_multibyte_characters) | 1664 | if (!NILP (current_buffer->enable_multibyte_characters) |
| 1664 | && FUNCTIONP (Vauto_composition_function) | 1665 | && ! NILP (Vauto_composition_mode) |
| 1665 | && find_automatic_composition (from, to, &start, &end, &gstring, | 1666 | && find_automatic_composition (from, to, &start, &end, &gstring, |
| 1666 | string)) | 1667 | string)) |
| 1667 | return list3 (make_number (start), make_number (end), gstring); | 1668 | return list3 (make_number (start), make_number (end), gstring); |
| @@ -1788,6 +1789,11 @@ The default value is the function `compose-chars-after'. */); | |||
| 1788 | Qauto_composition_function = intern_c_string ("auto-composition-function"); | 1789 | Qauto_composition_function = intern_c_string ("auto-composition-function"); |
| 1789 | staticpro (&Qauto_composition_function); | 1790 | staticpro (&Qauto_composition_function); |
| 1790 | 1791 | ||
| 1792 | DEFVAR_LISP ("auto-composition-mode", &Vauto_composition_mode, | ||
| 1793 | doc: /* Non-nil if Auto-Composition mode is enabled. | ||
| 1794 | Use the command `auto-composition-mode' to change this variable. */); | ||
| 1795 | Vauto_composition_mode = Qt; | ||
| 1796 | |||
| 1791 | DEFVAR_LISP ("auto-composition-function", &Vauto_composition_function, | 1797 | DEFVAR_LISP ("auto-composition-function", &Vauto_composition_function, |
| 1792 | doc: /* Function to call to compose characters automatically. | 1798 | doc: /* Function to call to compose characters automatically. |
| 1793 | This function is called from the display routine with four arguments: | 1799 | This function is called from the display routine with four arguments: |