all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Re: new-line chars '\n' not printed?
@ 2015-04-18 18:45 Rostislav Svoboda
  0 siblings, 0 replies; only message in thread
From: Rostislav Svoboda @ 2015-04-18 18:45 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel@gnu.org Development

>> 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))))))



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-18 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-18 18:45 [PATCH] Re: new-line chars '\n' not printed? Rostislav Svoboda

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.