78
78
:type 'integer
79
79
:group 'haskell-indentation )
80
80
81
+ (defcustom haskell-indentation-birdtrack-extra-space t
82
+ " Append a space after every birdtrack in literate mode."
83
+ :type 'boolean
84
+ :group 'haskell-indentation )
85
+
86
+
81
87
; ; Avoid a global bogus definition (which the original run-time
82
88
; ; `defun' made), and support Emacs 21 without the syntax.el add-on.
83
89
(eval-when-compile
@@ -236,13 +242,12 @@ Preserves indentation and removes extra whitespace"
236
242
(skip-syntax-forward " -" )
237
243
(if (prog1 (and (eolp )
238
244
(not (= (haskell-current-column) ci)))
245
+ (delete-horizontal-space )
239
246
(if (not (eq haskell-literate 'bird ))
240
- (delete-horizontal-space )
241
- (skip-syntax-backward " -" )
242
- (indent-to 2 )
243
- (kill-region (point ) (progn (end-of-line ) (point ))))
244
- (newline )
245
- (when (eq haskell-literate 'bird )
247
+ (newline )
248
+ (when haskell-indentation-birdtrack-extra-space
249
+ (indent-to 2 ))
250
+ (newline )
246
251
(insert " > " )))
247
252
(haskell-indentation-reindent
248
253
(max (haskell-indentation-butlast indentations)
@@ -339,32 +344,33 @@ Preserves indentation and removes extra whitespace"
339
344
340
345
(defun haskell-indentation-delete-backward-char (n )
341
346
(interactive " p" )
342
- (if (haskell-indentation-outside-bird-line)
343
- (delete-backward-char n)
344
- (on-parse-error (delete-backward-char n)
345
- (cond
346
- ((and delete-selection-mode
347
- mark-active
348
- (not (= (point ) (mark ))))
349
- (delete-region (mark ) (point )))
350
- ((or (= (haskell-current-column) 0 )
351
- (> (haskell-current-column) (haskell-indentation-current-indentation))
352
- (nth 8 (syntax-ppss )))
353
- (delete-backward-char n))
354
- (t (let* ((ci (haskell-indentation-current-indentation))
355
- (pi (haskell-indentation-previous-indentation
356
- ci (haskell-indentation-find-indentations))))
357
- (save-excursion
358
- (cond (pi
359
- (move-to-column pi)
360
- (delete-region (point )
361
- (progn (move-to-column ci)
362
- (point ))))
363
- (t
364
- (beginning-of-line )
365
- (delete-region (max (point-min ) (- (point ) 1 ))
366
- (progn (move-to-column ci)
367
- (point ))))))))))))
347
+ (on-parse-error
348
+ (delete-backward-char n)
349
+ (cond
350
+ ((haskell-indentation-outside-bird-line)
351
+ (delete-backward-char n))
352
+ ((and delete-selection-mode
353
+ mark-active
354
+ (not (= (point ) (mark ))))
355
+ (delete-region (mark ) (point )))
356
+ ((or (= (haskell-current-column) 0 )
357
+ (> (haskell-current-column) (haskell-indentation-current-indentation))
358
+ (nth 8 (syntax-ppss )))
359
+ (delete-backward-char n))
360
+ (t (let* ((ci (haskell-indentation-current-indentation))
361
+ (pi (haskell-indentation-previous-indentation
362
+ ci (haskell-indentation-find-indentations))))
363
+ (save-excursion
364
+ (cond (pi
365
+ (move-to-column pi)
366
+ (delete-region (point )
367
+ (progn (move-to-column ci)
368
+ (point ))))
369
+ (t
370
+ (beginning-of-line )
371
+ (delete-region (max (point-min ) (- (point ) 1 ))
372
+ (progn (move-to-column ci)
373
+ (point )))))))))))
368
374
369
375
(defun haskell-indentation-delete-char (n )
370
376
(interactive " p" )
@@ -399,6 +405,7 @@ Preserves indentation and removes extra whitespace"
399
405
(if (eq haskell-literate 'bird )
400
406
(catch 'return
401
407
(while (not (bobp ))
408
+ (forward-line -1 )
402
409
(when (not (eq (char-after ) ?> ))
403
410
(forward-line )
404
411
(forward-char 2 )
@@ -410,8 +417,7 @@ Preserves indentation and removes extra whitespace"
410
417
(when (and (>= 2 (haskell-indentation-current-indentation))
411
418
(not (looking-at " >\\ s-*$" )))
412
419
(forward-char 2 )
413
- (throw 'return nil ))
414
- (forward-line -1 )))
420
+ (throw 'return nil ))))
415
421
; ; not bird style
416
422
(catch 'return
417
423
(while (not (bobp ))
0 commit comments