Introduce LRM markers when needed in the address part of the subject lines.
authorLars Magne Ingebrigtsen <larsi@tmp-office.(none)>
Wed, 17 Aug 2011 23:09:34 +0000 (01:09 +0200)
committerLars Magne Ingebrigtsen <larsi@tmp-office.(none)>
Wed, 17 Aug 2011 23:09:34 +0000 (01:09 +0200)
lisp/ChangeLog
lisp/gnus-ems.el
lisp/gnus-spec.el
lisp/gnus-sum.el

index fa78c59..bd3afbf 100644 (file)
@@ -1,5 +1,15 @@
 2011-08-17  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-sum.el (gnus-summary-from-or-to-or-newsgroups): LRM-ify the
+       default From.
+
+       * gnus-spec.el (gnus-lrm-string-p): New macro.
+       (gnus-lrm-string): New constant.
+       (gnus-summary-line-format-spec): LRM-ify the from.
+       (gnus-tilde-max-form): LRM-ify string chopping.
+
+       * gnus-ems.el (gnus-string-mark-left-to-right): New function.
+
        * message.el (message-is-yours-p): Allow disabling canlock checking
        (bug#9295).
        (message-shoot-gnksa-feet): Add `canlock-verify'.
index bc85e49..aed471c 100644 (file)
          (setq start end
                end nil))))))
 
+(defmacro gnus-string-mark-left-to-right (string)
+  (if (fboundp 'string-mark-left-to-right)
+      `(string-mark-left-to-right ,string)
+    string))
+
 (eval-and-compile
   ;; XEmacs does not have window-inside-pixel-edges
   (defalias 'gnus-window-inside-pixel-edges
index 4682f51..15be32f 100644 (file)
@@ -90,6 +90,11 @@ text properties. This is only needed on XEmacs, as Emacs does this anyway."
 (declare-function gnus-summary-from-or-to-or-newsgroups "gnus-sum"
                   (header gnus-tmp-from))
 
+(defmacro gnus-lrm-string-p (string)
+  `(eq (aref ,string (1- (length ,string))) ?\x200e))
+
+(defvar gnus-lrm-string (propertize (string ?\x200e) 'invisible t))
+
 (defun gnus-summary-line-format-spec ()
   (insert gnus-tmp-unread gnus-tmp-replied
          gnus-tmp-score-char gnus-tmp-indentation)
@@ -103,7 +108,9 @@ text properties. This is only needed on XEmacs, as Emacs does this anyway."
                       (gnus-summary-from-or-to-or-newsgroups
                        gnus-tmp-header gnus-tmp-from))))
                (if (> (length val) 23)
-                   (substring val 0 23)
+                   (if (gnus-lrm-string-p val)
+                       (concat (substring val 0 23) gnus-lrm-string)
+                     (substring val 0 23))
                  val))
              gnus-tmp-closing-bracket))
      (point))
@@ -351,13 +358,17 @@ Return a list of updated types."
        `(if (> (,length-fun ,el) ,max)
             ,(if (< max-width 0)
                  `(,substring-fun ,el (- (,length-fun ,el) ,max))
-               `(,substring-fun ,el 0 ,max))
+               `(if (gnus-lrm-string-p ,el)
+                    (concat (,substring-fun ,el 0 ,max) ,gnus-lrm-string)
+                  (,substring-fun ,el 0 ,max)))
           ,el)
       `(let ((val (eval ,el)))
         (if (> (,length-fun val) ,max)
             ,(if (< max-width 0)
                  `(,substring-fun val (- (,length-fun val) ,max))
-               `(,substring-fun val 0 ,max))
+               `(if (gnus-lrm-string-p val)
+                    (concat (,substring-fun val 0 ,max) ,gnus-lrm-string)
+                  (,substring-fun val 0 ,max)))
           val)))))
 
 (defun gnus-tilde-cut-form (el cut-width)
index dda9cb3..cd4699e 100644 (file)
@@ -3709,7 +3709,9 @@ buffer that was in action when the last article was fetched."
                                 gnus-newsgroup-name)) 'nntp)
                      (gnus-group-real-name gnus-newsgroup-name))))
              (concat gnus-summary-newsgroup-prefix newsgroups)))))
-     (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
+     (gnus-string-mark-left-to-right
+      (inline
+       (gnus-summary-extract-address-component gnus-tmp-from))))))
 
 (defun gnus-summary-insert-line (gnus-tmp-header
                                 gnus-tmp-level gnus-tmp-current