Commits

didierv  committed 0f33436

set-annotation-glyph fixes

  • Participants
  • Parent commits 1d8a593

Comments (0)

Files changed (2)

+2000-01-10  Didier Verna  <didier@xemacs.org>
+
+	* annotations.el (set-annotation-glyph): preserve layout and side
+	when not specified, remove old glyph from the extent when chaging
+	the side of the annotation.
+
 1999-12-11  Andreas Jaeger  <aj@suse.de>
 
 	* timezone.el (timezone-parse-date): Years < 69 are 20YY.

File annotations.el

 The function `annotation-glyph' returns the current glyph."
   (if (not (annotationp annotation))
       (error "%s is not an annotation" annotation)
-    (progn
-      (if (not layout)
-	  (setq layout (or (extent-begin-glyph-layout annotation)
-			   (extent-end-glyph-layout annotation))))
-      (if (or (eq side 'right)
-	      (and (not (eq side 'left))
-		   (eq (annotation-side annotation) 'right)))
-	  (set-extent-end-glyph annotation glyph layout)
-	(set-extent-begin-glyph annotation glyph layout))
-      (aset (extent-property annotation 'annotation) 3 glyph)
-      (if (eq side 'right)
-	  (aset (extent-property annotation 'annotation) 5 t))
-      (if (eq side 'left)
-	  (aset (extent-property annotation 'annotation) 5 nil))
-      (annotation-glyph annotation))))
+    ;; else
+    (or layout (setq layout (annotation-layout annotation)))
+    (or side   (setq side   (annotation-side   annotation)))
+    (cond ((eq side 'left)
+	   (set-extent-begin-glyph annotation glyph layout)
+	   (set-extent-end-glyph annotation nil)
+	   (aset (extent-property annotation 'annotation) 5 nil))
+	  ((eq side 'right)
+	   (set-extent-end-glyph annotation glyph layout)
+	   (set-extent-begin-glyph annotation nil)
+	   (aset (extent-property annotation 'annotation) 5 nil)))
+    (aset (extent-property annotation 'annotation) 3 glyph)
+    (annotation-glyph annotation)))
 
 (defun annotation-down-glyph (annotation)
   "If ANNOTATION is of type `string' return the down string.  Otherwise,