emacscollective / auto-compile

Automatically compile Emacs Lisp libraries
GNU General Public License v3.0
172 stars 16 forks source link

Capitalise package description #6

Closed purcell closed 10 years ago

purcell commented 10 years ago

Just to fit in with conventions...

tarsius commented 10 years ago

Hehe, I knew you would raise that issue sooner or later. I'm afraid I have to disagree; there is no such convention. Maybe this is where we are headed but currently many libraries that are part of Emacs don't capitalize the library summary. Currently the summaries of all my libraries consistently begin with a lower-case letter.

I agree that in lists such as that generated by list-packages it would be nice for this to be consistent. That's why I have been using the following for the last five years:

(defun elx-summary (&optional file sanitize)
  "Return the one-line summary of file FILE.
If optional FILE is nil return the summary of the current buffer
instead.  When optional SANITIZE is non-nil a trailing period is
removed and the first word is upcases."
  (lm-with-file file
    (let ((summary-match
       (lambda ()
         (and (looking-at lm-header-prefix)
          (progn (goto-char (match-end 0))
             ;; There should be three dashes after the
             ;; filename but often there are only two or
             ;; even just one.
             (looking-at "[^ ]+[ \t]+-+[ \t]+\\(.*\\)"))))))
      (if (or (funcall summary-match)
          ;; Some people put the -*- specification on a separate
          ;; line, pushing the summary to the second or third line.
          (progn (forward-line) (funcall summary-match))
          (progn (forward-line) (funcall summary-match)))
      (let ((summary (match-string-no-properties 1)))
        (unless (equal summary "")
          ;; Strip off -*- specifications.
          (when (string-match "[ \t]*-\\*-.*-\\*-" summary)
        (setq summary (substring summary 0 (match-beginning 0))))
          (when sanitize
        (when (string-match "\\.$" summary)
          (setq summary (substring summary 0 -1)))
        (when (string-match "^[a-z]" summary)
          (setq summary
            (concat (upcase (substring summary 0 1))
                (substring summary 1)))))
          (unless (equal summary "")
        summary)))))))

Well that has changed a bit since I first added that function but the upcase was always there. I know I keep bringing this up, but you might really want to consider using elx.el :-)

purcell commented 10 years ago

LOL, yes, using elx could make sense, but it's not really the easiest fix. I guess we can at least say that the capitalisation is an "emerging convention", and I've probably helped get dozens of descriptions capitalised. It's not a big deal to me if there are some lower-cased descriptions around, but it always looks sloppy to me in the list-packages buffer, and there's no perfect way to automate the capitalisation IMO.

purcell commented 10 years ago

Maybe I'm just particularly picky since some of my work is as a news editor. :-)

tarsius commented 10 years ago

Well, when I decided not to upcase the first word in the summary I did that for aesthetic reasons too. Usually the summary isn't a full sentence, it shouldn't end with a period, and most importantly there often is no other uppercase letter anywhere on that line [edit: and the first ever letter (part of the filename) also isn't uppercase].

I will let this rest a bit and maybe I will change my mind eventually (and then change that for all of my libraries at once). But as of now I think my way is way prettier :-)

purcell commented 10 years ago

:-)