emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Re: new-line chars '\n' not printed?


From: Rostislav Svoboda
Subject: [PATCH] Re: new-line chars '\n' not printed?
Date: Sat, 18 Apr 2015 20:45:08 +0200

>> can anybody explain please me why the '\n' char is not printed:
>
> Because the text is filled.
>
>         (fill-region-as-paragraph pt2 (point))
>
> Andreas.

Thx!
I found the list of key-chords printed by help-fns--key-bindings
is separated by the ',' char and it becomes unreadable if one of
the key-chord contains ','. So below is a patch to fix it.
Could you please give me an advice what to do to get it merged
to the upstream?

New help-fns--key-bindings output:
It is bound to:
    C-c , d
    s-d

Old output:
It is bound to C-c , d, s-d.

thx
Bost

PS: And here comes my very first patch for emacs :-)


diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index e4890e0..4840f41 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -309,26 +309,27 @@ suitable file is found, return nil."
               (princ ".\n"))

             (when keys
-              (princ (if remapped
-                         "Without this remapping, it would be bound to "
-                       "It is bound to "))
-              ;; If lots of ordinary text characters run this command,
-              ;; don't mention them one by one.
-              (if (< (length non-modified-keys) 10)
-                  (princ (mapconcat 'key-description keys ", "))
-                (dolist (key non-modified-keys)
-                  (setq keys (delq key keys)))
-                (if keys
-                    (progn
-                      (princ (mapconcat 'key-description keys ", "))
-                      (princ ", and many ordinary text characters"))
-                  (princ "many ordinary text characters"))))
+              (let ((indent "\n    "))
+                (princ
+                 (concat (if remapped
+                             "Without this remapping, it would be bound to:"
+                           "It is bound to:")
+                         indent))
+                ;; If lots of ordinary text characters run this command,
+                ;; don't mention them one by one.
+                (if (< (length non-modified-keys) 10)
+                    (princ (mapconcat 'key-description keys indent))
+                  (dolist (key non-modified-keys)
+                    (setq keys (delq key keys)))
+                  (if keys
+                      (progn
+                        (princ (mapconcat 'key-description keys indent))
+                        (princ ", and many ordinary text characters"))
+                    (princ "many ordinary text characters")))))
             (when (or remapped keys non-modified-keys)
-              (princ ".")
               (terpri)))))

       (with-current-buffer standard-output
-        (fill-region-as-paragraph pt2 (point))
         (unless (looking-back "\n\n")
           (terpri))))))



reply via email to

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