bongo-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bongo-patches] Fix a whole slew of invisibility bugs introduced by the


From: Daniel Brockman
Subject: [bongo-patches] Fix a whole slew of invisibility bugs introduced by the marking code (reported by Daniel Jensen)
Date: Thu, 08 Feb 2007 22:14:24 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux)

2007-02-08  Daniel Brockman  <address@hidden>

        Fix a whole slew of invisibility bugs introduced by the marking
        code (reported by Daniel Jensen).

        * bongo.el (bongo-unmark-track-lines-satisfying)
        (bongo-unmark-all, bongo-redisplay-line, bongo-kill-marked)
        (bongo-copy-marked, bongo-enqueue-marked): Bind
        `line-move-ignore-invisible' to nil.
        (bongo-redisplay-line): Replace usage of `point-at-eol' and
        `point-at-bol' by `bongo-beginning-of-line', `bongo-end-of-line',
        `bongo-point-at-bol' and `bongo-point-at-eol'.  Set the
        `invisible' property on _the whole_ of invisible lines --- instead
        of just on the content text (excluding indentation and newline).
        (bongo-kill-line): Instead of `kill-line', use `kill-region' with
        `bongo-point-before-line' and `bongo-point-after-line' in order to
        get the correct behavior for invisible lines.
        (bongo-copy-line): Use `buffer-substring-filters' to remove any
        `invisible' properties from the text as it gets copied.


diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-02-08 22:13:38.000000000 +0100
+++ new-bongo/bongo.el  2007-02-08 22:13:38.000000000 +0100
@@ -3310,7 +3310,8 @@
 (defun bongo-unmark-all ()
   "Unmark all tracks in the current buffer."
   (interactive)
-  (let ((markers bongo-marked-track-line-markers))
+  (let ((markers bongo-marked-track-line-markers)
+        (line-move-ignore-invisible nil))
     (setq bongo-marked-track-line-markers nil)
     (save-excursion
       (dolist (marker markers)
@@ -3336,7 +3337,8 @@
 (defun bongo-unmark-track-lines-satisfying (predicate)
   "Unmark all track lines satisfying PREDICATE.
 Return the number of newly-unmarked tracks."
-  (let ((count 0))
+  (let ((count 0)
+        (line-move-ignore-invisible nil))
     (save-excursion
       (dolist (marker bongo-marked-track-line-markers)
         (goto-char marker)
@@ -6874,6 +6876,7 @@
   (when line-move-ignore-invisible
     (bongo-skip-invisible))
   (let ((inhibit-read-only t)
+        (line-move-ignore-invisible nil)
         (indentation (bongo-line-indentation))
         (infoset (bongo-line-internal-infoset))
         (header (bongo-header-line-p))
@@ -6890,21 +6893,19 @@
       (dotimes (dummy indentation)
         (insert bongo-indentation-string))
       (when marked
-        (goto-char (point-at-bol))
+        (bongo-beginning-of-line)
         (let ((mark-string (bongo-format-string bongo-mark-format)))
           (insert mark-string)
           (delete-char (min (length mark-string)
-                            (- (point-at-eol) (point)))))
-        (goto-char (point-at-eol)))
+                            (- (bongo-point-at-eol) (point)))))
+        (bongo-end-of-line))
       (let* ((bongo-infoset-formatting-target
               (current-buffer))
              (bongo-infoset-formatting-target-line
               (bongo-point-before-line))
              (content
-              (apply 'propertize (bongo-format-infoset infoset)
-                     'follow-link t 'mouse-face 'highlight
-                     (when invisible
-                       (list 'invisible invisible)))))
+              (propertize (bongo-format-infoset infoset)
+                          'follow-link t 'mouse-face 'highlight)))
         (if header
             (setq content (bongo-format-header content collapsed))
           (cond (currently-playing
@@ -6916,7 +6917,11 @@
         (insert content))
       (when marked
         (let ((bongo-facify-below-existing-faces t))
-          (bongo-facify-current-line 'bongo-marked-track-line))))))
+          (bongo-facify-current-line 'bongo-marked-track-line)))
+      (when invisible
+        (put-text-property (bongo-point-before-line)
+                           (bongo-point-after-line)
+                           'invisible t)))))
 
 (defun bongo-redisplay-region (beg end)
   "Redisplay the Bongo objects in the region between BEG and END."
@@ -7058,11 +7063,8 @@
                (bongo-line-set-property 'bongo-queued-track-flag t)
                (bongo-unset-queued-track-position)
                (bongo-line-remove-property 'bongo-queued-track-flag))
-             (let ((kill-whole-line t))
-               (beginning-of-line)
-               (when line-move-ignore-invisible
-                 (bongo-skip-invisible))
-               (kill-line)))
+             (kill-region (bongo-point-before-line)
+                          (bongo-point-after-line)))
             ((bongo-header-line-p)
              (save-excursion
                (beginning-of-line)
@@ -7089,7 +7091,8 @@
   "In Bongo, kill all marked track lines."
   (interactive)
   (when bongo-marked-track-line-markers
-    (let ((markers (nreverse bongo-marked-track-line-markers)))
+    (let ((markers (nreverse bongo-marked-track-line-markers))
+          (line-move-ignore-invisible nil))
       (setq bongo-marked-track-line-markers nil)
       (bongo-kill-line (car markers))
       (dolist (marker (cdr markers))
@@ -7124,7 +7127,14 @@
                  (bongo-point-after-object point)
                (bongo-point-after-line point))))
     (prog1 end
-      (copy-region-as-kill (bongo-point-before-line point) end))))
+      (let ((buffer-substring-filters
+             (cons (lambda (string)
+                     (prog1 (setq string (copy-sequence string))
+                       (remove-text-properties 0 (length string)
+                                               '(invisible nil)
+                                               string)))
+                   buffer-substring-filters)))
+        (copy-region-as-kill (bongo-point-before-line point) end)))))
 
 (bongo-define-obsolete-function-alias 'bongo-copy-line-as-kill
   'bongo-copy-line "2007-01-16")
@@ -7174,9 +7184,10 @@
 (defun bongo-copy-marked ()
   "In Bongo, copy all marked track lines."
   (interactive)
-  (dolist (marker (reverse bongo-marked-track-line-markers))
-    (bongo-copy-line marker)
-    (append-next-kill)))
+  (let ((line-move-ignore-invisible nil))
+    (dolist (marker (reverse bongo-marked-track-line-markers))
+      (bongo-copy-line marker)
+      (append-next-kill))))
 
 (defun bongo-copy-forward (&optional n)
   "In Bongo, copy N objects, or the region, or the marked tracks.
@@ -7435,7 +7446,8 @@
 Return the playlist position of the newly-inserted text."
   (when bongo-marked-track-line-markers
     (save-excursion
-      (let ((markers (reverse bongo-marked-track-line-markers)))
+      (let ((markers (reverse bongo-marked-track-line-markers))
+            (line-move-ignore-invisible nil))
         (goto-char (car markers))
         (prog1 (bongo-enqueue-line mode)
           (dolist (marker (cdr markers))
-- 
Daniel Brockman <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]