aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-02-13 15:10:57 +0000
committerStefan Monnier2008-02-13 15:10:57 +0000
commit02dfeba8a4ce93dadd7f5fa7f462fca12fdf28f8 (patch)
tree6f3af2c8cce69d443906f83ed834d82ec34b4a2f
parent78dc87a23feb2a1a5d5dc0c2a5abc3a310493dcf (diff)
downloademacs-02dfeba8a4ce93dadd7f5fa7f462fca12fdf28f8.tar.gz
emacs-02dfeba8a4ce93dadd7f5fa7f462fca12fdf28f8.zip
(smerge-auto-combine-max-separation): New var.
(smerge-auto-combine): New fun.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/smerge-mode.el21
-rw-r--r--src/ccl.h2
-rw-r--r--src/coding.h38
-rw-r--r--src/font.h10
-rw-r--r--src/lisp.h26
6 files changed, 68 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 927b3ce86aa..cfd106aca27 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-02-13 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * smerge-mode.el (smerge-auto-combine-max-separation): New var.
4 (smerge-auto-combine): New fun.
5
12008-02-12 Juri Linkov <juri@jurta.org> 62008-02-12 Juri Linkov <juri@jurta.org>
2 7
3 * startup.el (fancy-startup-screen, normal-splash-screen): 8 * startup.el (fancy-startup-screen, normal-splash-screen):
@@ -6,8 +11,8 @@
6 * desktop.el (after-init-hook): Set inhibit-startup-screen to t 11 * desktop.el (after-init-hook): Set inhibit-startup-screen to t
7 after reading the desktop. 12 after reading the desktop.
8 13
9 * progmodes/compile.el (compilation-auto-jump): Call 14 * progmodes/compile.el (compilation-auto-jump):
10 compile-goto-error only when compilation-auto-jump-to-first-error 15 Call compile-goto-error only when compilation-auto-jump-to-first-error
11 is non-nil. 16 is non-nil.
12 (compilation-scroll-output): Replace :type 'boolean with a choice 17 (compilation-scroll-output): Replace :type 'boolean with a choice
13 that has three options including a third option `first-error'. 18 that has three options including a third option `first-error'.
diff --git a/lisp/smerge-mode.el b/lisp/smerge-mode.el
index f2a7a9caf9e..8a3f15bac44 100644
--- a/lisp/smerge-mode.el
+++ b/lisp/smerge-mode.el
@@ -297,6 +297,8 @@ Can be nil if the style is undecided, or else:
297 297
298(defun smerge-combine-with-next () 298(defun smerge-combine-with-next ()
299 "Combine the current conflict with the next one." 299 "Combine the current conflict with the next one."
300 ;; `smerge-auto-combine' relies on the finish position (at the beginning
301 ;; of the closing marker).
300 (interactive) 302 (interactive)
301 (smerge-match-conflict) 303 (smerge-match-conflict)
302 (let ((ends nil)) 304 (let ((ends nil))
@@ -328,6 +330,25 @@ Can be nil if the style is undecided, or else:
328 (dolist (m match-data) (if m (move-marker m nil))) 330 (dolist (m match-data) (if m (move-marker m nil)))
329 (mapc (lambda (m) (if m (move-marker m nil))) ends))))) 331 (mapc (lambda (m) (if m (move-marker m nil))) ends)))))
330 332
333(defvar smerge-auto-combine-max-separation 2
334 "Max number of lines between conflicts that should be combined.")
335
336(defun smerge-auto-combine ()
337 "Automatically combine conflicts that are near each other."
338 (interactive)
339 (save-excursion
340 (goto-char (point-min))
341 (while (smerge-find-conflict)
342 ;; 2 is 1 (default) + 1 (the begin markers).
343 (while (save-excursion
344 (smerge-find-conflict
345 (line-beginning-position
346 (+ 2 smerge-auto-combine-max-separation))))
347 (forward-line -1) ;Go back inside the conflict.
348 (smerge-combine-with-next)
349 (forward-line 1) ;Move past the end of the conflict.
350 ))))
351
331(defvar smerge-resolve-function 352(defvar smerge-resolve-function
332 (lambda () (error "Don't know how to resolve")) 353 (lambda () (error "Don't know how to resolve"))
333 "Mode-specific merge function. 354 "Mode-specific merge function.
diff --git a/src/ccl.h b/src/ccl.h
index 3afb135fb56..4ac8b990fee 100644
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -117,7 +117,7 @@ EXFUN (Fccl_program_p, 1);
117#define CHECK_CCL_PROGRAM(x) \ 117#define CHECK_CCL_PROGRAM(x) \
118 do { \ 118 do { \
119 if (NILP (Fccl_program_p (x))) \ 119 if (NILP (Fccl_program_p (x))) \
120 x = wrong_type_argument (Qcclp, (x)); \ 120 wrong_type_argument (Qcclp, (x)); \
121 } while (0); 121 } while (0);
122 122
123#endif /* EMACS_CCL_H */ 123#endif /* EMACS_CCL_H */
diff --git a/src/coding.h b/src/coding.h
index 34196082afb..eba77273308 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -161,23 +161,23 @@ enum coding_attr_index
161 161
162/* Macros to access an element of an attribute vector. */ 162/* Macros to access an element of an attribute vector. */
163 163
164#define CODING_ATTR_BASE_NAME(attrs) AREF (attrs, coding_attr_base_name) 164#define CODING_ATTR_BASE_NAME(attrs) ASLOT (attrs, coding_attr_base_name)
165#define CODING_ATTR_TYPE(attrs) AREF (attrs, coding_attr_type) 165#define CODING_ATTR_TYPE(attrs) ASLOT (attrs, coding_attr_type)
166#define CODING_ATTR_CHARSET_LIST(attrs) AREF (attrs, coding_attr_charset_list) 166#define CODING_ATTR_CHARSET_LIST(attrs) ASLOT (attrs, coding_attr_charset_list)
167#define CODING_ATTR_MNEMONIC(attrs) AREF (attrs, coding_attr_mnemonic) 167#define CODING_ATTR_MNEMONIC(attrs) ASLOT (attrs, coding_attr_mnemonic)
168#define CODING_ATTR_DOCSTRING(attrs) AREF (attrs, coding_attr_docstring) 168#define CODING_ATTR_DOCSTRING(attrs) ASLOT (attrs, coding_attr_docstring)
169#define CODING_ATTR_ASCII_COMPAT(attrs) AREF (attrs, coding_attr_ascii_compat) 169#define CODING_ATTR_ASCII_COMPAT(attrs) ASLOT (attrs, coding_attr_ascii_compat)
170#define CODING_ATTR_DECODE_TBL(attrs) AREF (attrs, coding_attr_decode_tbl) 170#define CODING_ATTR_DECODE_TBL(attrs) ASLOT (attrs, coding_attr_decode_tbl)
171#define CODING_ATTR_ENCODE_TBL(attrs) AREF (attrs, coding_attr_encode_tbl) 171#define CODING_ATTR_ENCODE_TBL(attrs) ASLOT (attrs, coding_attr_encode_tbl)
172#define CODING_ATTR_TRANS_TBL(attrs) AREF (attrs, coding_attr_trans_tbl) 172#define CODING_ATTR_TRANS_TBL(attrs) ASLOT (attrs, coding_attr_trans_tbl)
173#define CODING_ATTR_POST_READ(attrs) AREF (attrs, coding_attr_post_read) 173#define CODING_ATTR_POST_READ(attrs) ASLOT (attrs, coding_attr_post_read)
174#define CODING_ATTR_PRE_WRITE(attrs) AREF (attrs, coding_attr_pre_write) 174#define CODING_ATTR_PRE_WRITE(attrs) ASLOT (attrs, coding_attr_pre_write)
175#define CODING_ATTR_DEFAULT_CHAR(attrs) AREF (attrs, coding_attr_default_char) 175#define CODING_ATTR_DEFAULT_CHAR(attrs) ASLOT (attrs, coding_attr_default_char)
176#define CODING_ATTR_FOR_UNIBYTE(attrs) AREF (attrs, coding_attr_for_unibyte) 176#define CODING_ATTR_FOR_UNIBYTE(attrs) ASLOT (attrs, coding_attr_for_unibyte)
177#define CODING_ATTR_FLUSHING(attrs) AREF (attrs, coding_attr_flushing) 177#define CODING_ATTR_FLUSHING(attrs) ASLOT (attrs, coding_attr_flushing)
178#define CODING_ATTR_PLIST(attrs) AREF (attrs, coding_attr_plist) 178#define CODING_ATTR_PLIST(attrs) ASLOT (attrs, coding_attr_plist)
179#define CODING_ATTR_CATEGORY(attrs) AREF (attrs, coding_attr_category) 179#define CODING_ATTR_CATEGORY(attrs) ASLOT (attrs, coding_attr_category)
180#define CODING_ATTR_SAFE_CHARSETS(attrs)AREF (attrs, coding_attr_safe_charsets) 180#define CODING_ATTR_SAFE_CHARSETS(attrs)ASLOT (attrs, coding_attr_safe_charsets)
181 181
182 182
183/* Return the name of a coding system specified by ID. */ 183/* Return the name of a coding system specified by ID. */
@@ -241,7 +241,7 @@ enum coding_attr_index
241 spec = CODING_SYSTEM_SPEC (x); \ 241 spec = CODING_SYSTEM_SPEC (x); \
242 } \ 242 } \
243 if (NILP (spec)) \ 243 if (NILP (spec)) \
244 x = wrong_type_argument (Qcoding_system_p, (x)); \ 244 wrong_type_argument (Qcoding_system_p, (x)); \
245 } while (0) 245 } while (0)
246 246
247 247
@@ -258,7 +258,7 @@ enum coding_attr_index
258 id = CODING_SYSTEM_ID (x); \ 258 id = CODING_SYSTEM_ID (x); \
259 } \ 259 } \
260 if (id < 0) \ 260 if (id < 0) \
261 x = wrong_type_argument (Qcoding_system_p, (x)); \ 261 wrong_type_argument (Qcoding_system_p, (x)); \
262 } while (0) 262 } while (0)
263 263
264 264
diff --git a/src/font.h b/src/font.h
index b8aa4e1f3a4..21e821e6e71 100644
--- a/src/font.h
+++ b/src/font.h
@@ -233,17 +233,17 @@ struct font_bitmap
233/* Check macros for various font-related objects. */ 233/* Check macros for various font-related objects. */
234 234
235#define CHECK_FONT(x) \ 235#define CHECK_FONT(x) \
236 do { if (! FONTP (x)) x = wrong_type_argument (Qfont, x); } while (0) 236 do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (0)
237#define CHECK_FONT_SPEC(x) \ 237#define CHECK_FONT_SPEC(x) \
238 do { if (! FONT_SPEC_P (x)) x = wrong_type_argument (Qfont, x); } while (0) 238 do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont, x); } while (0)
239#define CHECK_FONT_ENTITY(x) \ 239#define CHECK_FONT_ENTITY(x) \
240 do { if (! FONT_ENTITY_P (x)) x = wrong_type_argument (Qfont, x); } while (0) 240 do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont, x); } while (0)
241#define CHECK_FONT_OBJECT(x) \ 241#define CHECK_FONT_OBJECT(x) \
242 do { if (! FONT_OBJECT_P (x)) x = wrong_type_argument (Qfont, x); } while (0) 242 do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont, x); } while (0)
243 243
244#define CHECK_FONT_GET_OBJECT(x, font) \ 244#define CHECK_FONT_GET_OBJECT(x, font) \
245 do { \ 245 do { \
246 if (! FONT_OBJECT_P (x)) x = wrong_type_argument (Qfont, x); \ 246 if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont, x); \
247 if (! XSAVE_VALUE (x)->pointer) error ("Font already closed"); \ 247 if (! XSAVE_VALUE (x)->pointer) error ("Font already closed"); \
248 font = XSAVE_VALUE (x)->pointer; \ 248 font = XSAVE_VALUE (x)->pointer; \
249 } while (0) 249 } while (0)
diff --git a/src/lisp.h b/src/lisp.h
index 8221a85c13e..f72c15e9d76 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -588,13 +588,17 @@ extern size_t pure_size;
588 588
589/* Convenience macros for dealing with Lisp arrays. */ 589/* Convenience macros for dealing with Lisp arrays. */
590 590
591#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX] 591#define ASLOT(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
592#define ASIZE(ARRAY) XVECTOR ((ARRAY))->size 592#define ASIZE(ARRAY) XVECTOR ((ARRAY))->size
593/* The IDX==IDX tries to detect when the macro argument is side-effecting. */ 593/* The IDX==IDX checks that the macro argument is not side-effecting. */
594#define AREF(ARRAY, IDX) \
595 (eassert ((IDX) == (IDX)), \
596 eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
597 ASLOT (ARRAY, (IDX)))
594#define ASET(ARRAY, IDX, VAL) \ 598#define ASET(ARRAY, IDX, VAL) \
595 (eassert ((IDX) == (IDX)), \ 599 (eassert ((IDX) == (IDX)), \
596 eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \ 600 eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
597 AREF ((ARRAY), (IDX)) = (VAL)) 601 ASLOT ((ARRAY), (IDX)) = (VAL))
598 602
599/* Convenience macros for dealing with Lisp strings. */ 603/* Convenience macros for dealing with Lisp strings. */
600 604
@@ -686,12 +690,12 @@ struct Lisp_Cons
686#define CAR(c) \ 690#define CAR(c) \
687 (CONSP ((c)) ? XCAR ((c)) \ 691 (CONSP ((c)) ? XCAR ((c)) \
688 : NILP ((c)) ? Qnil \ 692 : NILP ((c)) ? Qnil \
689 : wrong_type_argument (Qlistp, (c))) 693 : (wrong_type_argument (Qlistp, (c)), Qnil))
690 694
691#define CDR(c) \ 695#define CDR(c) \
692 (CONSP ((c)) ? XCDR ((c)) \ 696 (CONSP ((c)) ? XCDR ((c)) \
693 : NILP ((c)) ? Qnil \ 697 : NILP ((c)) ? Qnil \
694 : wrong_type_argument (Qlistp, (c))) 698 : (wrong_type_argument (Qlistp, (c)), Qnil))
695 699
696/* Take the car or cdr of something whose type is not known. */ 700/* Take the car or cdr of something whose type is not known. */
697#define CAR_SAFE(c) \ 701#define CAR_SAFE(c) \
@@ -1090,25 +1094,25 @@ struct Lisp_Hash_Table
1090 1094
1091/* Value is the key part of entry IDX in hash table H. */ 1095/* Value is the key part of entry IDX in hash table H. */
1092 1096
1093#define HASH_KEY(H, IDX) AREF ((H)->key_and_value, 2 * (IDX)) 1097#define HASH_KEY(H, IDX) ASLOT ((H)->key_and_value, 2 * (IDX))
1094 1098
1095/* Value is the value part of entry IDX in hash table H. */ 1099/* Value is the value part of entry IDX in hash table H. */
1096 1100
1097#define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1) 1101#define HASH_VALUE(H, IDX) ASLOT ((H)->key_and_value, 2 * (IDX) + 1)
1098 1102
1099/* Value is the index of the next entry following the one at IDX 1103/* Value is the index of the next entry following the one at IDX
1100 in hash table H. */ 1104 in hash table H. */
1101 1105
1102#define HASH_NEXT(H, IDX) AREF ((H)->next, (IDX)) 1106#define HASH_NEXT(H, IDX) ASLOT ((H)->next, (IDX))
1103 1107
1104/* Value is the hash code computed for entry IDX in hash table H. */ 1108/* Value is the hash code computed for entry IDX in hash table H. */
1105 1109
1106#define HASH_HASH(H, IDX) AREF ((H)->hash, (IDX)) 1110#define HASH_HASH(H, IDX) ASLOT ((H)->hash, (IDX))
1107 1111
1108/* Value is the index of the element in hash table H that is the 1112/* Value is the index of the element in hash table H that is the
1109 start of the collision list at index IDX in the index vector of H. */ 1113 start of the collision list at index IDX in the index vector of H. */
1110 1114
1111#define HASH_INDEX(H, IDX) AREF ((H)->index, (IDX)) 1115#define HASH_INDEX(H, IDX) ASLOT ((H)->index, (IDX))
1112 1116
1113/* Value is the size of hash table H. */ 1117/* Value is the size of hash table H. */
1114 1118
@@ -2252,7 +2256,7 @@ extern unsigned long cons_to_long P_ ((Lisp_Object));
2252extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; 2256extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2253extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, 2257extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object,
2254 Lisp_Object)) NO_RETURN; 2258 Lisp_Object)) NO_RETURN;
2255extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; 2259extern void wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2256extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object, 2260extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
2257 Lisp_Object, struct buffer *)); 2261 Lisp_Object, struct buffer *));
2258extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object)); 2262extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));