emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/easy-mmode.el


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/easy-mmode.el
Date: Sat, 07 May 2005 11:05:00 -0400

Index: emacs/lisp/emacs-lisp/easy-mmode.el
diff -c emacs/lisp/emacs-lisp/easy-mmode.el:1.59 
emacs/lisp/emacs-lisp/easy-mmode.el:1.60
*** emacs/lisp/emacs-lisp/easy-mmode.el:1.59    Tue Apr 26 14:15:54 2005
--- emacs/lisp/emacs-lisp/easy-mmode.el Sat May  7 15:05:00 2005
***************
*** 58,73 ****
  
  (defun easy-mmode-pretty-mode-name (mode &optional lighter)
    "Turn the symbol MODE into a string intended for the user.
! If provided LIGHTER will be used to help choose capitalization."
    (let* ((case-fold-search t)
         (name (concat (replace-regexp-in-string
                        "-Minor" " minor"
                        (capitalize (replace-regexp-in-string
                                     "-mode\\'" "" (symbol-name mode))))
                       " mode")))
      (if (not (stringp lighter)) name
!       (setq lighter (replace-regexp-in-string "\\`\\s-+\\|\\-s+\\'" "" 
lighter))
!       (replace-regexp-in-string lighter lighter name t t))))
  
  ;;;###autoload
  (defalias 'easy-mmode-define-minor-mode 'define-minor-mode)
--- 58,86 ----
  
  (defun easy-mmode-pretty-mode-name (mode &optional lighter)
    "Turn the symbol MODE into a string intended for the user.
! If provided, LIGHTER will be used to help choose capitalization by,
! replacing its case-insensitive matches with the literal string in LIGHTER."
    (let* ((case-fold-search t)
+        ;; Produce "Foo-Bar Minor mode" from foo-bar-minor-mode.
         (name (concat (replace-regexp-in-string
+                       ;; "Foo-Bar-Minor" -> "Foo-Bar minor"
                        "-Minor" " minor"
+                       ;; "foo-bar-minor" -> "Foo-Bar-Minor"
                        (capitalize (replace-regexp-in-string
+                                    ;; "foo-bar-minor-mode" -> "foo-bar-minor"
                                     "-mode\\'" "" (symbol-name mode))))
                       " mode")))
      (if (not (stringp lighter)) name
!       ;; Strip leading and trailing whitespace from LIGHTER.
!       (setq lighter (replace-regexp-in-string "\\`\\s-+\\|\\s-+\\'" ""
!                                             lighter))
!       ;; Replace any (case-insensitive) matches for LIGHTER in NAME
!       ;; with a literal LIGHTER.  E.g., if NAME is "Iimage mode" and
!       ;; LIGHTER is " iImag", then this will produce "iImage mode".
!       ;; (LIGHTER normally comes from the mode-line string passed to
!       ;; define-minor-mode, and normally includes at least one leading
!       ;; space.)
!       (replace-regexp-in-string (regexp-quote lighter) lighter name t t))))
  
  ;;;###autoload
  (defalias 'easy-mmode-define-minor-mode 'define-minor-mode)




reply via email to

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