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

« back to all changes in this revision

Viewing changes to debian/patches/50_protbuf_custom_and_toggle.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_protbuf_custom_and_toggle.dpatch by Peter S Galbraith <psg@debian.org>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: protbuf - custom support + true toggles.
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/protbuf.el emacs-goodies-el/elisp/emacs-goodies-el/protbuf.el
27
 
--- /home/psg/emacs/emacs-goodies-el/emacs-goodies-el/elisp/emacs-goodies-el/protbuf.el 2003-10-07 19:18:26.000000000 -0400
28
 
+++ emacs-goodies-el/elisp/emacs-goodies-el/protbuf.el  2003-10-07 21:20:08.000000000 -0400
29
 
@@ -29,24 +29,49 @@
30
 
 
31
 
 ;; This package allows you to make it harder to kill buffers accidentally,
32
 
 ;; e.g. by being too trigger happy selecting items in the buffer menu.
33
 
-;; protect-process-buffer-from-kill-mode is perhaps the more useful of the
34
 
-;; two, making it harder to accidentally kill shell buffers without
35
 
+;;
36
 
+;; The commands are:
37
 
+;;
38
 
+;; `protect-buffer-from-kill-mode'
39
 
+;;   Toggle kill-buffer protection on current buffer.
40
 
+;;
41
 
+;; `protect-process-buffer-from-kill-mode'
42
 
+;;   Toggle kill-buffer protection on current buffer with active process.
43
 
+;;   Protection only applies as long as the buffer has an active process.
44
 
+;;
45
 
+;; `protect-process-buffer-from-kill-mode' is perhaps the more useful of
46
 
+;; the two, making it harder to accidentally kill shell buffers without
47
 
 ;; terminating the process in them first.
48
 
 
49
 
+;;; History:
50
 
+;;
51
 
+;; 2003-10-07 Peter S Galbraith <psg@debian.org>
52
 
+;;  - custom interface support.
53
 
+;;  - make interactive commands toggle the minor-mode.
54
 
+;;  - some checkdoc changes.
55
 
+
56
 
 ;;; Code:
57
 
 
58
 
-(defvar protect-buffer-verbose t
59
 
-  "*If non-nil, print a message when attempting to kill a protected buffer.")
60
 
+(defgroup protect-buffer nil
61
 
+  "Protect buffers from accidental killing."
62
 
+  :group 'killing)
63
 
 
64
 
-(defvar protect-buffer-bury-p t
65
 
+(defcustom protect-buffer-verbose t
66
 
+  "*If non-nil, print a message when attempting to kill a protected buffer."
67
 
+  :type 'boolean
68
 
+  :group 'protect-buffer)
69
 
+
70
 
+(defcustom protect-buffer-bury-p t
71
 
   "*If non-nil, bury buffer when attempting to kill it.
72
 
 This only has an effect if the buffer to be killed is the one
73
 
-visible in the selected window.")
74
 
+visible in the selected window."
75
 
+  :type 'boolean
76
 
+  :group 'protect-buffer)
77
 
 
78
 
 
79
 
 ;;;###autoload
80
 
 (defvar protect-buffer-from-kill-mode nil
81
 
-  "*If non-`nil', then prevent buffer from being accidentally killed.
82
 
+  "*If non-nil, then prevent buffer from being accidentally killed.
83
 
 This variable is local to all buffers.")
84
 
 (progn
85
 
   (make-variable-buffer-local 'protect-buffer-from-kill-mode)
86
 
@@ -57,7 +82,7 @@
87
 
 
88
 
 ;;;###autoload
89
 
 (defvar protect-process-buffer-from-kill-mode nil
90
 
-  "*If non-`nil', then protect buffer with live process from being killed.
91
 
+  "*If non-nil, then protect buffer with live process from being killed.
92
 
 This variable is local to all buffers.")
93
 
 (progn
94
 
   (make-variable-buffer-local 'protect-process-buffer-from-kill-mode)
95
 
@@ -84,32 +109,26 @@
96
 
 
97
 
 ;;;###autoload
98
 
 (defun protect-buffer-from-kill-mode (&optional prefix buffer)
99
 
-  "Protect buffer from being killed.
100
 
-To remove this protection, call this command with a negative prefix argument."
101
 
+  "Toggle `kill-buffer' protection on current buffer.
102
 
+Optionally, set a PREFIX argument to set or unset protection, and specify
103
 
+alternate BUFFER."
104
 
   (interactive "P")
105
 
-  (or buffer (setq buffer (current-buffer)))
106
 
   (save-excursion
107
 
-    ;; Each cond does its own set-buffer *after* comparing prefix just in
108
 
-    ;; case there's a buffer-local variable `prefix' to screw up the works.
109
 
-    (cond
110
 
-     ((null prefix)
111
 
-      (set-buffer buffer)
112
 
-      (setq protect-buffer-from-kill-mode
113
 
-            (not protect-buffer-from-kill-mode)))
114
 
-     ((>= prefix 0)
115
 
-      (set-buffer buffer)
116
 
-      (setq protect-buffer-from-kill-mode t))
117
 
-     (t
118
 
-      (set-buffer buffer)
119
 
-      (setq protect-buffer-from-kill-mode nil)))
120
 
+    (if buffer
121
 
+        (set-buffer buffer))
122
 
+    (set (make-local-variable 'protect-buffer-from-kill-mode)
123
 
+         (if prefix
124
 
+             (> (prefix-numeric-value prefix) 0)
125
 
+           (not protect-buffer-from-kill-mode)))
126
 
     ;; This is always done because kill-buffer-query-functions might have
127
 
     ;; been buffer-local when this package was initially loaded, leaving
128
 
     ;; the global value unchanged.
129
 
     (add-hook 'kill-buffer-query-functions 'protect-buffer-from-kill)))
130
 
 
131
 
-;; This function is listed in kill-buffer-query-functions; it should return
132
 
-;; nil if the buffer should not be killed, t otherwise.
133
 
 (defun protect-buffer-from-kill ()
134
 
+  "Implements protection from buffer killing.
135
 
+This function is listed in `kill-buffer-query-functions'; it should return
136
 
+nil if the buffer should not be killed, t otherwise."
137
 
   (cond
138
 
    (protect-buffer-from-kill-mode
139
 
     (and protect-buffer-verbose
140
 
@@ -125,32 +144,27 @@
141
 
 
142
 
 ;;;###autoload
143
 
 (defun protect-process-buffer-from-kill-mode (&optional prefix buffer)
144
 
-  "Protect buffer from being killed as long as it has an active process.
145
 
-To remove this protection, call this command with a negative prefix argument."
146
 
+  "Toggle `kill-buffer' protection on current buffer with active process.
147
 
+Protection only applies as long as the buffer has an active process.
148
 
+Optionally, set a PREFIX argument to set or unset protection, and specify
149
 
+alternate BUFFER."
150
 
   (interactive "P")
151
 
-  (or buffer (setq buffer (current-buffer)))
152
 
   (save-excursion
153
 
-    ;; Each cond does its own set-buffer *after* comparing prefix just in
154
 
-    ;; case there's a buffer-local variable `prefix' to screw up the works.
155
 
-    (cond
156
 
-     ((null prefix)
157
 
-      (set-buffer buffer)
158
 
-      (setq protect-process-buffer-from-kill-mode
159
 
-            (not protect-process-buffer-from-kill-mode)))
160
 
-     ((>= prefix 0)
161
 
-      (set-buffer buffer)
162
 
-      (setq protect-process-buffer-from-kill-mode t))
163
 
-     (t
164
 
-      (set-buffer buffer)
165
 
-      (setq protect-process-buffer-from-kill-mode nil)))
166
 
+    (if buffer
167
 
+        (set-buffer buffer))
168
 
+    (set (make-local-variable 'protect-process-buffer-from-kill-mode)
169
 
+         (if prefix
170
 
+             (> (prefix-numeric-value prefix) 0)
171
 
+           (not protect-process-buffer-from-kill-mode)))
172
 
     ;; This is always done because kill-buffer-query-functions might have
173
 
     ;; been buffer-local when this package was initially loaded, leaving
174
 
     ;; the global value unchanged.
175
 
     (add-hook 'kill-buffer-query-functions 'protect-process-buffer-from-kill)))
176
 
 
177
 
-;; This function is listed in kill-buffer-query-functions; it should return
178
 
-;; nil if the buffer should be protected, t if buffer should be killed.
179
 
 (defun protect-process-buffer-from-kill ()
180
 
+  "Implements protection from buffer killing.
181
 
+This function is listed in `kill-buffer-query-functions'; it should return
182
 
+nil if the buffer should be protected, t if buffer should be killed."
183
 
   (cond
184
 
    ((not protect-process-buffer-from-kill-mode) t)
185
 
    ((or (and (boundp 'protect-process-buffer-from-kill-preserve-function)