annotate lisp/progmodes/subword.el @ 109602:a86a4e812897

Package listing tweaks. * emacs-lisp/package.el (package--list-packages): Fix column alignment. (package--builtins): Tweak descriptions. (package-print-package): Upcase descriptions if necessary. Show all built-in packages in font-lock-builtin-face. (package-list-packages-internal): Omit "emacs" package. Show status of built-in packages as "built-in".
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 31 Jul 2010 20:38:19 -0400
parents 762db3570fa8
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
106182
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
1 ;;; subword.el --- Handling capitalized subwords in a nomenclature
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106352
diff changeset
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
106182
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
4
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
5 ;; Author: Masatake YAMATO
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
6
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
8
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
12 ;; (at your option) any later version.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
13
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
18
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
21
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
22 ;;; Commentary:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
23
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
24 ;; This package was cc-submode.el before it was recognized being
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
25 ;; useful in general and not tied to C and c-mode at all.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
26
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
27 ;; This package provides `subword' oriented commands and a minor mode
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
28 ;; (`subword-mode') that substitutes the common word handling
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
29 ;; functions with them.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
30
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
31 ;; In spite of GNU Coding Standards, it is popular to name a symbol by
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
32 ;; mixing uppercase and lowercase letters, e.g. "GtkWidget",
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
33 ;; "EmacsFrameClass", "NSGraphicsContext", etc. Here we call these
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
34 ;; mixed case symbols `nomenclatures'. Also, each capitalized (or
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
35 ;; completely uppercase) part of a nomenclature is called a `subword'.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
36 ;; Here are some examples:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
37
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
38 ;; Nomenclature Subwords
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
39 ;; ===========================================================
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
40 ;; GtkWindow => "Gtk" and "Window"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
41 ;; EmacsFrameClass => "Emacs", "Frame" and "Class"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
42 ;; NSGraphicsContext => "NS", "Graphics" and "Context"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
43
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
44 ;; The subword oriented commands defined in this package recognize
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
45 ;; subwords in a nomenclature to move between them and to edit them as
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
46 ;; words.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
47
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
48 ;; In the minor mode, all common key bindings for word oriented
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
49 ;; commands are overridden by the subword oriented commands:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
50
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
51 ;; Key Word oriented command Subword oriented command
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
52 ;; ============================================================
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
53 ;; M-f `forward-word' `subword-forward'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
54 ;; M-b `backward-word' `subword-backward'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
55 ;; M-@ `mark-word' `subword-mark'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
56 ;; M-d `kill-word' `subword-kill'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
57 ;; M-DEL `backward-kill-word' `subword-backward-kill'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
58 ;; M-t `transpose-words' `subword-transpose'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
59 ;; M-c `capitalize-word' `subword-capitalize'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
60 ;; M-u `upcase-word' `subword-upcase'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
61 ;; M-l `downcase-word' `subword-downcase'
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
62 ;;
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
63 ;; Note: If you have changed the key bindings for the word oriented
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
64 ;; commands in your .emacs or a similar place, the keys you've changed
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
65 ;; to are also used for the corresponding subword oriented commands.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
66
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
67 ;; To make the mode turn on automatically, put the following code in
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
68 ;; your .emacs:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
69 ;;
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
70 ;; (add-hook 'c-mode-common-hook
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
71 ;; (lambda () (subword-mode 1)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
72 ;;
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
73
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
74 ;; Acknowledgment:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
75 ;; The regular expressions to detect subwords are mostly based on
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
76 ;; the old `c-forward-into-nomenclature' originally contributed by
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
77 ;; Terry_Glanfield dot Southern at rxuk dot xerox dot com.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
78
108720
762db3570fa8 * isearch.el (isearch-yank-word-or-char): Pull next subword
Juri Linkov <juri@jurta.org>
parents: 106815
diff changeset
79 ;; TODO: ispell-word.
106182
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
80
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
81 ;;; Code:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
82
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
83 (defvar subword-mode-map
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
84 (let ((map (make-sparse-keymap)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
85 (dolist (cmd '(forward-word backward-word mark-word kill-word
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
86 backward-kill-word transpose-words
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
87 capitalize-word upcase-word downcase-word))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
88 (let ((othercmd (let ((name (symbol-name cmd)))
106194
95389cbb5f73 * progmodes/subword.el (subword-mode-map): Fix subword-mode-map
Tassilo Horn <tassilo@member.fsf.org>
parents: 106182
diff changeset
89 (string-match "\\([[:alpha:]-]+\\)-word[s]?" name)
95389cbb5f73 * progmodes/subword.el (subword-mode-map): Fix subword-mode-map
Tassilo Horn <tassilo@member.fsf.org>
parents: 106182
diff changeset
90 (intern (concat "subword-" (match-string 1 name))))))
106182
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
91 (define-key map (vector 'remap cmd) othercmd)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
92 map)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
93 "Keymap used in `subword-mode' minor mode.")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
94
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
95 ;;;###autoload
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
96 (define-minor-mode subword-mode
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
97 "Mode enabling subword movement and editing keys.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
98 In spite of GNU Coding Standards, it is popular to name a symbol by
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
99 mixing uppercase and lowercase letters, e.g. \"GtkWidget\",
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
100 \"EmacsFrameClass\", \"NSGraphicsContext\", etc. Here we call these
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
101 mixed case symbols `nomenclatures'. Also, each capitalized (or
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
102 completely uppercase) part of a nomenclature is called a `subword'.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
103 Here are some examples:
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
104
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
105 Nomenclature Subwords
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
106 ===========================================================
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
107 GtkWindow => \"Gtk\" and \"Window\"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
108 EmacsFrameClass => \"Emacs\", \"Frame\" and \"Class\"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
109 NSGraphicsContext => \"NS\", \"Graphics\" and \"Context\"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
110
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
111 The subword oriented commands activated in this minor mode recognize
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
112 subwords in a nomenclature to move between subwords and to edit them
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
113 as words.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
114
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
115 \\{subword-mode-map}"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
116 nil
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
117 nil
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
118 subword-mode-map)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
119
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
120 (define-obsolete-function-alias 'c-subword-mode 'subword-mode "23.2")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
121
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
122 ;;;###autoload
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
123 (define-global-minor-mode global-subword-mode subword-mode
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
124 (lambda () (subword-mode 1)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
125
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
126 (defun subword-forward (&optional arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
127 "Do the same as `forward-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
128 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
129 Optional argument ARG is the same as for `forward-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
130 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
131 (unless arg (setq arg 1))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
132 (cond
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
133 ((< 0 arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
134 (dotimes (i arg (point))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
135 (subword-forward-internal)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
136 ((> 0 arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
137 (dotimes (i (- arg) (point))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
138 (subword-backward-internal)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
139 (t
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
140 (point))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
141
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
142 (put 'subword-forward 'CUA 'move)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
143
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
144 (defun subword-backward (&optional arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
145 "Do the same as `backward-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
146 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
147 Optional argument ARG is the same as for `backward-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
148 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
149 (subword-forward (- (or arg 1))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
150
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
151 (defun subword-mark (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
152 "Do the same as `mark-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
153 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
154 Optional argument ARG is the same as for `mark-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
155 ;; This code is almost copied from `mark-word' in GNU Emacs.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
156 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
157 (cond ((and (eq last-command this-command) (mark t))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
158 (set-mark
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
159 (save-excursion
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
160 (goto-char (mark))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
161 (subword-forward arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
162 (point))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
163 (t
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
164 (push-mark
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
165 (save-excursion
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
166 (subword-forward arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
167 (point))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
168 nil t))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
169
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
170 (put 'subword-backward 'CUA 'move)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
171
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
172 (defun subword-kill (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
173 "Do the same as `kill-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
174 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
175 Optional argument ARG is the same as for `kill-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
176 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
177 (kill-region (point) (subword-forward arg)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
178
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
179 (defun subword-backward-kill (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
180 "Do the same as `backward-kill-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
181 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
182 Optional argument ARG is the same as for `backward-kill-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
183 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
184 (subword-kill (- arg)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
185
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
186 (defun subword-transpose (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
187 "Do the same as `transpose-words' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
188 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
189 Optional argument ARG is the same as for `transpose-words'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
190 (interactive "*p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
191 (transpose-subr 'subword-forward arg))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
192
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
193 (defun subword-downcase (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
194 "Do the same as `downcase-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
195 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
196 Optional argument ARG is the same as for `downcase-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
197 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
198 (let ((start (point)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
199 (downcase-region (point) (subword-forward arg))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
200 (when (< arg 0)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
201 (goto-char start))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
202
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
203 (defun subword-upcase (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
204 "Do the same as `upcase-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
205 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
206 Optional argument ARG is the same as for `upcase-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
207 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
208 (let ((start (point)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
209 (upcase-region (point) (subword-forward arg))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
210 (when (< arg 0)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
211 (goto-char start))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
212
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
213 (defun subword-capitalize (arg)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
214 "Do the same as `capitalize-word' but on subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
215 See the command `subword-mode' for a description of subwords.
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
216 Optional argument ARG is the same as for `capitalize-word'."
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
217 (interactive "p")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
218 (let ((count (abs arg))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
219 (start (point))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
220 (advance (if (< arg 0) nil t)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
221 (dotimes (i count)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
222 (if advance
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
223 (progn (re-search-forward
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
224 (concat "[[:alpha:]]")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
225 nil t)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
226 (goto-char (match-beginning 0)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
227 (subword-backward))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
228 (let* ((p (point))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
229 (pp (1+ p))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
230 (np (subword-forward)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
231 (upcase-region p pp)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
232 (downcase-region pp np)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
233 (goto-char (if advance np p))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
234 (unless advance
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
235 (goto-char start))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
236
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
237
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
238
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
239 ;;
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
240 ;; Internal functions
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
241 ;;
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
242 (defun subword-forward-internal ()
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
243 (if (and
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
244 (save-excursion
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
245 (let ((case-fold-search nil))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
246 (re-search-forward
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
247 (concat "\\W*\\(\\([[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
248 nil t)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
249 (> (match-end 0) (point)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
250 (goto-char
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
251 (cond
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
252 ((< 1 (- (match-end 2) (match-beginning 2)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
253 (1- (match-end 2)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
254 (t
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
255 (match-end 0))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
256 (forward-word 1)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
257
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
258
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
259 (defun subword-backward-internal ()
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
260 (if (save-excursion
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
261 (let ((case-fold-search nil))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
262 (re-search-backward
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
263 (concat
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
264 "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([[:upper:]]+\\W*\\)"
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
265 "\\|\\W\\w+\\)")
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
266 nil t)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
267 (goto-char
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
268 (cond
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
269 ((and (match-end 3)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
270 (< 1 (- (match-end 3) (match-beginning 3)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
271 (not (eq (point) (match-end 3))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
272 (1- (match-end 3)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
273 (t
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
274 (1+ (match-beginning 0)))))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
275 (backward-word 1)))
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
276
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
277
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
278 (provide 'subword)
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
279
106352
3b90f039f42b Add arch tagline
Miles Bader <miles@gnu.org>
parents: 106194
diff changeset
280 ;; arch-tag: b8a01202-8a52-4a71-ae0a-d753fafd67ef
106182
3fa8f9dfb121 * progmodes/subword.el: Rename from lisp/subword.el.
Tassilo Horn <tassilo@member.fsf.org>
parents:
diff changeset
281 ;;; subword.el ends here