~ubuntu-branches/ubuntu/precise/emacs-goodies-el/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/50_setnu.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-06-22 19:03:03 UTC
  • mfrom: (4.1.20 sid)
  • Revision ID: james.westby@ubuntu.com-20100622190303-ygrbht6kae9ukl8m
Tags: 33.6ubuntu1
* Merge from debian unstable.  Remaining changes: LP: #597284
  - Add {hardy,jaunty,karmic,lucid}-proposed distribution targets
    to dpkg-dev-el.
  - Add maverick{,-proposed} distribution targets; drop out the lucid
    non-proposed target, since uploads to the release pocket are not
    permitted for stable releases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh -e
2
 
## 50_setnu.dpatch by Peter S Galbraith <psg@debian.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: setnu defface and checkdoc cleanup.
6
 
 
7
 
if [ $# -ne 1 ]; then
8
 
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
9
 
    exit 1
10
 
fi
11
 
 
12
 
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
13
 
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
14
 
 
15
 
case "$1" in
16
 
       -patch) patch $patch_opts -p1 < $0;;
17
 
       -unpatch) patch $patch_opts -p1 -R < $0;;
18
 
        *)
19
 
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
20
 
                exit 1;;
21
 
esac
22
 
 
23
 
exit 0
24
 
 
25
 
@DPATCH@
26
 
diff -urNad /home/psg/emacs/emacs-goodies-el/emacs-goodies-el/elisp/emacs-goodies-el/setnu.el emacs-goodies-el/elisp/emacs-goodies-el/setnu.el
27
 
--- /home/psg/emacs/emacs-goodies-el/emacs-goodies-el/elisp/emacs-goodies-el/setnu.el   2003-10-15 20:54:31.000000000 -0400
28
 
+++ emacs-goodies-el/elisp/emacs-goodies-el/setnu.el    2003-10-14 21:37:45.000000000 -0400
29
 
@@ -1,32 +1,42 @@
30
 
-;;; vi-style line number mode for Emacs
31
 
-;;; (requires Emacs 19.29 or later, or XEmacs 19.14 or later)
32
 
-;;; Copyright (C) 1994, 1995, 1997 Kyle E. Jones
33
 
-;;;
34
 
-;;; This program is free software; you can redistribute it and/or modify
35
 
-;;; it under the terms of the GNU General Public License as published by
36
 
-;;; the Free Software Foundation; either version 2, or (at your option)
37
 
-;;; any later version.
38
 
-;;;
39
 
-;;; This program is distributed in the hope that it will be useful,
40
 
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
41
 
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42
 
-;;; GNU General Public License for more details.
43
 
-;;;
44
 
-;;; A copy of the GNU General Public License can be obtained from this
45
 
-;;; program's author (send electronic mail to kyle@uunet.uu.net) or from
46
 
-;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
47
 
-;;; 02139, USA.
48
 
-;;;
49
 
-;;; Send bug reports to kyle@wonderworks.com
50
 
+;;; setnu.el --- vi-style line number mode for Emacs
51
 
+;;
52
 
+;; (requires Emacs 19.29 or later, or XEmacs 19.14 or later)
53
 
+;; Copyright (C) 1994, 1995, 1997 Kyle E. Jones
54
 
+;;
55
 
+;; This program is free software; you can redistribute it and/or modify
56
 
+;; it under the terms of the GNU General Public License as published by
57
 
+;; the Free Software Foundation; either version 2, or (at your option)
58
 
+;; any later version.
59
 
+;;
60
 
+;; This program is distributed in the hope that it will be useful,
61
 
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
62
 
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
63
 
+;; GNU General Public License for more details.
64
 
+;;
65
 
+;; A copy of the GNU General Public License can be obtained from this
66
 
+;; program's author (send electronic mail to kyle@uunet.uu.net) or from
67
 
+;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
68
 
+;; 02139, USA.
69
 
+
70
 
+;;; Commentary:
71
 
+;;
72
 
+;; Send bug reports to kyle@wonderworks.com
73
 
 ;;
74
 
 ;; M-x setnu-mode toggles the line number mode on and off.
75
 
 ;;
76
 
-;; turn-on-setnu-mode is useful for adding to a major-mode hook
77
 
-;; variable.
78
 
+;; turn-on-setnu-mode is useful for adding to a major-mode hook variable.
79
 
 ;; Example:
80
 
 ;;     (add-hook 'text-mode-hook 'turn-on-setnu-mode)
81
 
-;; to automatically turn on line numbering when enterting text-mode."
82
 
+;;  to automatically turn on line numbering when enterting text-mode."
83
 
 
84
 
+;;; History:
85
 
+;; 
86
 
+;; 2003-10-13 Peter S Galbraith <psg@debian.org>
87
 
+;;  - made checkdoc changes (but it's still not happy).
88
 
+;;  - created settnu defgroup and created defface setnu-line-number-face.
89
 
+;;  - added atoload tags.
90
 
+
91
 
+;;; Code:
92
 
 (provide 'setnu)
93
 
 
94
 
 (defconst setnu-running-under-xemacs
95
 
@@ -34,20 +44,20 @@
96
 
       (string-match "Lucid" emacs-version)))
97
 
 
98
 
 (defconst setnu-mode-version "1.06"
99
 
-  "Version number for this release of setnu-mode.")
100
 
+  "Version number for this release of `setnu-mode'.")
101
 
 
102
 
 (defvar setnu-mode nil
103
 
-  "Non-nil if setnu-mode is active in the current buffer.")
104
 
+  "Non-nil if `setnu-mode' is active in the current buffer.")
105
 
 (make-variable-buffer-local 'setnu-mode)
106
 
 
107
 
 (defvar setnu-start-extent nil
108
 
-  "First extent of a chain of extents used by setnu-mode.
109
 
+  "First extent of a chain of extents used by `setnu-mode'.
110
 
 Each line has its own extent.  Each line extent has a
111
 
 `setnu-next-extent' property that points to the next extent in
112
 
 the chain, which is the extent for the next line in the buffer.
113
 
 There is also a `setnu-prev-extent' that points at the previous
114
 
 extent in the chain.  To distinguish them from other extents the
115
 
-setnu-mode extents all have a non-nil `setnu' property.")
116
 
+`setnu-mode' extents all have a non-nil `setnu' property.")
117
 
 (make-variable-buffer-local 'setnu-start-extent)
118
 
 
119
 
 (defvar setnu-glyph-obarray (make-vector 401 0)
120
 
@@ -66,14 +76,21 @@
121
 
 `format' will be called with this string and one other argument
122
 
 which will be an integer, the line number.")
123
 
 
124
 
-(defvar setnu-line-number-face 'bold
125
 
-  "*Face used to display the line numbers.
126
 
-Currently this works for XEmacs 19.12 and later versions only.")
127
 
+(defvar setnu-line-number-face 'setnu-line-number-face
128
 
+  "*Face used to display the line numbers.")
129
 
+
130
 
+(defgroup setnu nil
131
 
+  "vi-style line number mode for Emacs.")
132
 
+
133
 
+(defface setnu-line-number-face '((t (:bold t)))
134
 
+  "*Face used to display the line numbers."
135
 
+  :group 'setnu)
136
 
 
137
 
+;;;###autoload
138
 
 (defun setnu-mode (&optional arg)
139
 
-  "Toggle setnu-mode.
140
 
-With prefix argument, turn setnu-mode on if argument is positive.
141
 
-When setnu-mode is enabled, a line number will appear at the left
142
 
+  "Toggle `setnu-mode'.
143
 
+With prefix argument ARG, turn `setnu-mode' on if argument is positive.
144
 
+When `setnu-mode' is enabled, a line number will appear at the left
145
 
 margin of each line."
146
 
   (interactive "P")
147
 
   (let ((oldmode (not (not setnu-mode)))
148
 
@@ -85,12 +102,13 @@
149
 
            (setnu-mode-on)
150
 
          (setnu-mode-off)))))
151
 
 
152
 
+;;;###autoload
153
 
 (defun turn-on-setnu-mode ()
154
 
-  "Turn on setnu-mode.
155
 
-Useful for adding to a major-mode hook variable.
156
 
+  "Turn on `setnu-mode'.
157
 
+Useful for adding to a `major-mode' hook variable.
158
 
 Example:
159
 
     (add-hook 'text-mode-hook 'turn-on-setnu-mode)
160
 
-to automatically turn on line numbering when enterting text-mode."
161
 
+to automatically turn on line numbering when enterting `text-mode'."
162
 
   (setnu-mode 1))
163
 
 
164
 
 ;;; Internal functions
165
 
@@ -148,8 +166,8 @@
166
 
         (put-text-property 0 (length g) 'face face g))))
167
 
 
168
 
 (defun setnu-mode-off ()
169
 
-  "Internal shutdown of setnu-mode.
170
 
-Deletes the extents associated with setnu-mode."
171
 
+  "Internal shutdown of `setnu-mode'.
172
 
+Deletes the extents associated with `setnu-mode'."
173
 
   (if (and setnu-running-under-xemacs
174
 
           (fboundp 'remove-specifier))
175
 
       (remove-specifier left-margin-width (current-buffer)))
176
 
@@ -163,11 +181,13 @@
177
 
        (setq setnu-start-extent nil))))
178
 
 
179
 
 (defun setnu-mode-on ()
180
 
-  "Internal startup of setnu-mode.
181
 
-Sets up the extents associated with setnu-mode."
182
 
+  "Internal startup of `setnu-mode'.
183
 
+Sets up the extents associated with `setnu-mode'."
184
 
   (if (and setnu-running-under-xemacs
185
 
           (fboundp 'set-specifier))
186
 
       (set-specifier left-margin-width 6 (current-buffer)))
187
 
+  (add-hook 'before-change-functions 'setnu-before-change-function)
188
 
+  (add-hook 'after-change-functions 'setnu-after-change-function)
189
 
   (let ((done nil)
190
 
        (curr-e nil)
191
 
        (n 1)
192
 
@@ -196,9 +216,9 @@
193
 
       (store-match-data match-data))))
194
 
 
195
 
 (defun setnu-before-change-function (start end)
196
 
-  "Before change function for setnu-mode.
197
 
+  "Before change function for `setnu-mode'.
198
 
 Notices when a delete is about to delete some lines and adjusts
199
 
-the line number extents accordingly."
200
 
+the line number extents accordingly (betwee START and END)."
201
 
   (if (or (not setnu-mode) (= start end))
202
 
       () ;; not in setnu-mode or this is an insertion
203
 
     (let ((inhibit-quit t)
204
 
@@ -252,9 +272,12 @@
205
 
        (store-match-data match-data)))))
206
 
 
207
 
 (defun setnu-after-change-function (start end length)
208
 
-  "After change function for setnu-mode.
209
 
+  "After change function for `setnu-mode'.
210
 
 Notices when an insert has added some lines and adjusts
211
 
-the line number extents accordingly."
212
 
+the line number extents accordingly.
213
 
+Three arguments are passed to an `after-change-function': the positions of
214
 
+the START and END of the range of changed text,
215
 
+and the LENGTH in bytes of the pre-change text replaced by that range."
216
 
   (if (or (not setnu-mode) (= start end))
217
 
       () ; not in setnu-mode or this is a deletion
218
 
     (let ((inhibit-quit t)
219
 
@@ -331,7 +354,8 @@
220
 
        g ))))
221
 
 
222
 
 (defun setnu-make-setnu-extent (beg end)
223
 
-  "Create an extent and set some properties that all setnu extents have."
224
 
+  "Create an extent and set some properties that all setnu extents have.
225
 
+Extent is between BEG and END."
226
 
   (let ((e (setnu-make-extent beg end)))
227
 
     (setnu-set-extent-property e 'setnu t)
228
 
 ;;    (setnu-set-extent-property e 'begin-glyph-layout 'outside-margin)
229
 
@@ -389,11 +413,12 @@
230
 
                                       e
231
 
                                     nil)))
232
 
                       buf pos pos)))
233
 
-       (t (error "can't find overlays-in, overlays-at, or map-extents!")))
234
 
+       (t (error "Can't find overlays-in, overlays-at, or map-extents!")))
235
 
 
236
 
 (defun setnu-extent-at-create (pos buf)
237
 
-  "Like `setnu-extent-at' except if an extent isn't found, then
238
 
-it is created based on where the extent failed to be found."
239
 
+  "Like `setnu-extent-at' for position POS in buffer BUF.
240
 
+If an extent isn't found, then it is created based on where the extent failed
241
 
+to be found."
242
 
   (let ((e (setnu-extent-at pos buf)) ee beg numstr)
243
 
     (if e
244
 
        e
245
 
@@ -444,5 +469,6 @@
246
 
               (setnu-set-extent-begin-glyph e (setnu-number-glyph numstr))
247
 
               e ))))))
248
 
 
249
 
-(add-hook 'before-change-functions 'setnu-before-change-function)
250
 
-(add-hook 'after-change-functions 'setnu-after-change-function)
251
 
+(provide 'setnu)
252
 
+
253
 
+;;; setnu.el ends here