From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Nicolas P. Rougier" Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: splash-screen Date: Sun, 27 Sep 2020 12:42:04 +0200 Message-ID: References: <87d02ej7bq.fsf@gnus.org> <874knoekki.fsf@gnus.org> <87mu1fb8kb.fsf@gnus.org> <83v9fzo8ka.fsf@gnu.org> <5a42dae1-6650-c658-5f2d-58c31d916d80@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37026"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 27.1 Cc: Eli Zaretskii , rms@gnu.org, larsi@gnus.org, thibaut.verron@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 27 12:42:46 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMU8j-0009Wg-K7 for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Sep 2020 12:42:45 +0200 Original-Received: from localhost ([::1]:56128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMU8i-0008Da-Kr for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Sep 2020 06:42:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMU8D-0007ob-6E for emacs-devel@gnu.org; Sun, 27 Sep 2020 06:42:13 -0400 Original-Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:24422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMU8B-0004jT-7k; Sun, 27 Sep 2020 06:42:12 -0400 X-IronPort-AV: E=Sophos;i="5.77,309,1596492000"; d="el'?scan'208";a="360154462" Original-Received: from 91-160-114-139.subs.proxad.net (HELO M-E7-NPR.local) ([91.160.114.139]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2020 12:42:05 +0200 In-reply-to: <5a42dae1-6650-c658-5f2d-58c31d916d80@yandex.ru> Received-SPF: pass client-ip=192.134.164.104; envelope-from=nicolas.rougier@inria.fr; helo=mail3-relais-sop.national.inria.fr X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 06:42:06 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:256535 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: base64 DQpMYXRlc3QgbW9ja3VwOg0KDQor4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCT4oCT4oCT4oCT4oCT 4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT4oCT 4oCT4oCT4oCT4oCT4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU4oCU 4oCU4oCU4oCUKw0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgd3d3LmdudS5vcmcgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgIEdOVSBFbWFjcyB2ZXJzaW9uIFhYLlkgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KfCAgICAgR05VIEVtYWNzIGNvbWVzIHdpdGggYWJzb2x1dGVseSBubyB3YXJy YW50eSAgICAgfA0KfCAgQ29weXJpZ2h0IChDKSAyMDIwIEZyZWUgU29mdHdhcmUgRm91bmRhdGlv biwgSW5jLiAgfA0KfCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgfA0KK+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KA k+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KAk+KA k+KAk+KAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKAlOKA lCsNCg0Kd3d3LmdudS5vcmc6DQogLSBsaW5rICAgIDogaHR0cHM6Ly93d3cuZ251Lm9yZy9waGls b3NvcGh5DQogLSB0b29sdGlwIDogUmVhZCBhYm91dCBHTlUgcGhpbG9zb3BoeQ0KDQpHTlUgRW1h Y3MgY29tZXMgd2l0aCBhYnNvbHV0ZWx5IG5vIHdhcnJhbnR5DQogLSBsaW5rICAgIDogJ2Rlc2Ny aWJlLW5vLXdhcnJhbnR5DQogLSB0b29sdGlwIDogUmVhZCB3YXJyYW50eSBub3RpY2UNCg0KQ29w eXJpZ2h0IChDKSAyMDIwIEZyZWUgU29mdHdhcmUgRm91bmRhdGlvbiwgSW5jLg0KIC0gbGluayAg ICA6ICdkZXNjcmliZS1jb3B5aW5nDQogLSB0b29sdGlwIDogUmVhZCBjb3B5aW5nIGNvbmRpdGlv bnMNCg0KUmV0dXJuLCBlc2NhcGUgb3IgcSBraWxscyBzcGxhc2gNCkFueSBvdGhlciBrZXkgc2hv d3MgJ2Fib3V0LWVtYWNzDQpTcGxhc2ggc3RheXMgZm9yIDEwIHNlY29uZHMgYW5kIGZhZGUgdG8g J2Fib3V0LWVtYWNzLg0KDQpCdWc6IE1vdXNlIGNsaWNrIGRvZXNuJ3Qgd29yayBwcm9wZXJseSBz aW5jZSBJIGJvdW5kIFt0XSAoYW55IGtleSkgDQphbmQgSSdtIHVuYWJsZSB0byBiaW5kIG1vdXNl IGtleXMgYWZ0ZXIgdGhhdC4NCg0K --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=splash-screen.el Content-Transfer-Encoding: quoted-printable Content-Description: Splash Screen code ;;; splash-screen.el -- An alternative splash screen -*- lexical-binding: t= ; -*- ;; Copyright (C) 2020 Nicolas .P Rougier ;; Author: Nicolas P. Rougier ;; URL: https://github.com/rougier/emacs-splash ;; Keywords: startup ;; Version: 0.1 ;; Package-Requires:=20 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; ;; An alternative splash screen: ;; ;; +=E2=80=93=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93= =E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2= =80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80= =93=E2=80=93=E2=80=93=E2=80=93=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94+ ;; | | ;; | | ;; | | ;; | | ;; | | ;; | www.gnu.org | ;; | GNU Emacs version XX.Y | ;; | | ;; | | ;; | | ;; | | ;; | GNU Emacs comes with absolutely no warranty | ;; | Copyright (C) 2020 Free Software Foundation, Inc. | ;; | | ;; +=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80= =93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93= =E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2= =80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80=93=E2=80= =93=E2=80=93=E2=80=93=E2=80=93=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94+ ;; ;; Features: ;; ;; - No logo, no moddeline, no scrollbars ;; - "q", " ", or kills the splash screen ;; - Any other key open the about-emacs buffer ;; - With emacs-mac (Mituharu), splash screen is faded out after 3 seconds ;; ;; Note: The screen is not shown if there are opened file buffers. For ;; example, if you start emacs with a filename on the command ;; line, the splash screen is not shown. ;; ;; Usage: ;;=20 ;; (require 'splash-screen) ;; ;;; Code: (require 'cl-lib) (defun splash-screen () "Emacs splash screen" =20=20 (interactive) (let* ((splash-buffer (get-buffer-create "*splash*")) (height (- (window-body-height nil) 1)) (width (window-body-width nil)) (padding-center (- (/ height 2) 1)) (padding-bottom (- height (/ height 2) 1))) =20=20=20=20 ;; If there are buffer associated with filenames, ;; we don't show the splash screen. (if (eq 0 (length (cl-loop for buf in (buffer-list) if (buffer-file-name buf) collect (buffer-file-name buf)))) =20=20=20=20=20=20=20=20 (with-current-buffer splash-buffer (erase-buffer) =20=20=20=20=20=20=20=20=20=20 ;; Buffer local settings (if (one-window-p) (setq mode-line-format nil)) (setq cursor-type nil) (setq line-spacing 0) (setq vertical-scroll-bar nil) (setq horizontal-scroll-bar nil) (setq fill-column width) (face-remap-add-relative 'link :underline nil) (if (not (display-graphic-p)) (menu-bar-mode 0)) ;; Vertical padding to center (insert-char ?\n padding-center) ;; www.gnu.org (insert-text-button "www.gnu.org" 'action (lambda (_) (browse-url "https://www.gnu.org/philosophy/")) 'help-echo (center-string "- Read about GNU philosophy -") 'face 'link 'follow-link t) (center-line) ;; GNU Emacs version XX.Y (insert "\n") (insert (concat (propertize "GNU Emacs" 'face 'bold) " " "version " (format "%d.%d" emacs-major-version emacs-minor-version))) (center-line) =20=20=20=20=20=20=20=20=20=20 ;; Vertical padding to bottom (insert-char ?\n padding-bottom) ;; Warranty notice (insert-button "GNU Emacs comes with absolutely no warranty" 'action (lambda (_) (describe-no-warranty)) 'face (if (window-system) 'shadow 'default) 'help-echo (center-string "- Read warranty notice -") 'follow-link t) (center-line) ;; Copyright notice (insert "\n") (insert-button "Copyright (C) 2020 Free Software Foundation, Inc." 'action (lambda (_) (describe-copying)) 'face (if (window-system) 'shadow 'default) 'help-echo (center-string "- Read copying conditions -") 'follow-link t) (center-line) =20=20=20=20=20=20=20=20=20=20 (goto-char 0) (read-only-mode t) =20=20=20=20=20=20=20=20=20=20 (local-set-key [t] 'splash-screen-fade-to-about) (local-set-key (kbd " ") 'splash-screen-fade-to-about) (local-set-key (kbd "C-[") 'splash-screen-fade-to-default) (local-set-key (kbd "") 'splash-screen-fade-to-default) (local-set-key (kbd "q") 'splash-screen-fade-to-default) (local-set-key (kbd "") 'splash-screen-fade-to-default) (local-set-key (kbd "") 'splash-screen-fade-to-default) (local-set-key (kbd "") 'mouse-set-point) (local-set-key (kbd "") 'operate-this-button) (display-buffer-same-window splash-buffer nil) (run-with-idle-timer 10.0 nil 'splash-screen-fade-to-about) )))) (defun center-string (string) "Pad a string with space on the left such as to center it" (let* ((padding (/ (- (window-body-width) (length string)) 2)) (padding (+ (length string) padding))) ;; If the string is displayed as a tooltip, don't pad it (if (and tooltip-mode (fboundp 'x-show-tip)) string (format (format "%%%ds" padding) string)))) ;; Mac animation, only available from ;; https://bitbucket.org/mituharu/emacs-mac/src/master/ ;; https://github.com/railwaycat/homebrew-emacsmacport (defvar mac-animation-locked-p nil) (defun mac-animation-toggle-lock () (setq mac-animation-locked-p (not mac-animation-locked-p))) (defun mac-animation-fade-out (duration &rest args) (unless mac-animation-locked-p (mac-animation-toggle-lock) (mac-start-animation nil :type 'fade-out :duration duration) (run-with-timer duration nil 'mac-animation-toggle-lock))) (defun splash-screen-fade-to (about duration) "Fade out current frame for duration and goes to command-or-bufffer" (interactive) (defalias 'mac-animation-fade-out-local (apply-partially 'mac-animation-fade-out duration)) (if (get-buffer "*splash*") (progn (if (and (display-graphic-p) (fboundp 'mac-start-animation)) (advice-add 'set-window-buffer :before 'mac-animation-fade-out-local)) (if about (about-emacs)) (kill-buffer "*splash*") (if (and (display-graphic-p) (fboundp 'mac-start-animation)) (advice-remove 'set-window-buffer 'mac-animation-fade-out-local))))) (defun splash-screen-fade-to-about () (interactive) (splash-screen-fade-to 1 1.0)) (defun splash-screen-fade-to-default () (interactive) (splash-screen-fade-to nil 0.25)) (defun splash-screen-kill () "Kill the splash screen buffer (immediately)." (interactive) (if (get-buffer "*splash*") (kill-buffer "*splash*"))) ;; Suppress any startup message in the echo area (run-with-idle-timer 0.05 nil (lambda() (message nil))) ;; Install hook after frame parameters have been applied and only if ;; no option on the command line (if (and (not (member "-no-splash" command-line-args)) (not (member "--file" command-line-args)) (not (member "--insert" command-line-args)) (not (member "--find-file" command-line-args)) ;; (not inhibit-startup-screen) ) (progn (add-hook 'window-setup-hook 'splash-screen) (setq inhibit-startup-screen t=20 inhibit-startup-message t inhibit-startup-echo-area-message t))) (provide 'splash-screen) ;;; splash-screen.el ends here --=-=-=--