comparison lisp/startup.el @ 84790:e2a2c43a4876

(fancy-startup-text, fancy-about-text, fancy-startup-tail): Add help-echo to external links and to links without description. (fancy-splash-insert): Use help-echo from the 3rd element of the link specification list, or "Follow this link" if it's nil. Doc fix.
author Juri Linkov <juri@jurta.org>
date Sat, 22 Sep 2007 22:14:40 +0000
parents f1d4dbead0be
children 54aa4c1eb6d6
comparison
equal deleted inserted replaced
84789:cc57ea69513c 84790:e2a2c43a4876
1155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1156 1156
1157 (defvar fancy-startup-text 1157 (defvar fancy-startup-text
1158 '((:face (variable-pitch :foreground "red") 1158 '((:face (variable-pitch :foreground "red")
1159 "Welcome to " 1159 "Welcome to "
1160 :link ("GNU Emacs" (lambda (button) (browse-url "http://www.gnu.org/software/emacs/"))) 1160 :link ("GNU Emacs"
1161 (lambda (button) (browse-url "http://www.gnu.org/software/emacs/"))
1162 "Browse http://www.gnu.org/software/emacs/")
1161 ", one component of the " 1163 ", one component of the "
1162 :link 1164 :link
1163 (lambda () 1165 (lambda ()
1164 (if (eq system-type 'gnu/linux) 1166 (if (eq system-type 'gnu/linux)
1165 '("GNU/Linux" (lambda (button) (browse-url "http://www.gnu.org/gnu/linux-and-gnu.html"))) 1167 '("GNU/Linux"
1166 '("GNU" (lambda (button) (describe-project))))) 1168 (lambda (button) (browse-url "http://www.gnu.org/gnu/linux-and-gnu.html"))
1169 "Browse http://www.gnu.org/gnu/linux-and-gnu.html")
1170 '("GNU" (lambda (button) (describe-project))
1171 "Display info on the GNU project")))
1167 " operating system.\n" 1172 " operating system.\n"
1168 :face variable-pitch "To quit a partially entered command, type " 1173 :face variable-pitch "To quit a partially entered command, type "
1169 :face default "Control-g" 1174 :face default "Control-g"
1170 :face variable-pitch ".\n\n" 1175 :face variable-pitch ".\n\n"
1171 :link ("Emacs Tutorial" (lambda (button) (help-with-tutorial))) 1176 :link ("Emacs Tutorial" (lambda (button) (help-with-tutorial)))
1187 "" 1192 ""
1188 (concat " (" title ")")))) 1193 (concat " (" title ")"))))
1189 "\n" 1194 "\n"
1190 :face variable-pitch 1195 :face variable-pitch
1191 :link ("Emacs Guided Tour" 1196 :link ("Emacs Guided Tour"
1192 (lambda (button) (browse-url "http://www.gnu.org/software/emacs/tour/"))) 1197 (lambda (button) (browse-url "http://www.gnu.org/software/emacs/tour/"))
1198 "Browse http://www.gnu.org/software/emacs/tour/")
1193 "\tOverview of Emacs features\n" 1199 "\tOverview of Emacs features\n"
1194 :link ("View Emacs Manual" (lambda (button) (info-emacs-manual))) 1200 :link ("View Emacs Manual" (lambda (button) (info-emacs-manual)))
1195 "\tView the Emacs manual using Info\n" 1201 "\tView the Emacs manual using Info\n"
1196 :link ("Absence of Warranty" (lambda (button) (describe-no-warranty))) 1202 :link ("Absence of Warranty" (lambda (button) (describe-no-warranty)))
1197 "\tGNU Emacs comes with " 1203 "\tGNU Emacs comes with "
1208 `:face FACE', like `fancy-splash-insert' accepts them.") 1214 `:face FACE', like `fancy-splash-insert' accepts them.")
1209 1215
1210 (defvar fancy-about-text 1216 (defvar fancy-about-text
1211 '((:face (variable-pitch :foreground "red") 1217 '((:face (variable-pitch :foreground "red")
1212 "This is " 1218 "This is "
1213 :link ("GNU Emacs" (lambda (button) (browse-url "http://www.gnu.org/software/emacs/"))) 1219 :link ("GNU Emacs"
1220 (lambda (button) (browse-url "http://www.gnu.org/software/emacs/"))
1221 "Browse http://www.gnu.org/software/emacs/")
1214 ", one component of the " 1222 ", one component of the "
1215 :link 1223 :link
1216 (lambda () 1224 (lambda ()
1217 (if (eq system-type 'gnu/linux) 1225 (if (eq system-type 'gnu/linux)
1218 '("GNU/Linux" (lambda (button) (browse-url "http://www.gnu.org/gnu/linux-and-gnu.html"))) 1226 '("GNU/Linux"
1219 '("GNU" (lambda (button) (describe-project))))) 1227 (lambda (button) (browse-url "http://www.gnu.org/gnu/linux-and-gnu.html"))
1228 "Browse http://www.gnu.org/gnu/linux-and-gnu.html")
1229 '("GNU" (lambda (button) (describe-project))
1230 "Display info on the GNU project.")))
1220 " operating system.\n" 1231 " operating system.\n"
1221 :face (lambda () 1232 :face (lambda ()
1222 (list 'variable-pitch :foreground 1233 (list 'variable-pitch :foreground
1223 (if (eq (frame-parameter nil 'background-mode) 'dark) 1234 (if (eq (frame-parameter nil 'background-mode) 'dark)
1224 "cyan" "darkblue"))) 1235 "cyan" "darkblue")))
1272 (if (string= en tut) 1283 (if (string= en tut)
1273 "" 1284 ""
1274 (concat " (" title ")")))) 1285 (concat " (" title ")"))))
1275 "\n" 1286 "\n"
1276 :link ("Emacs Guided Tour" 1287 :link ("Emacs Guided Tour"
1277 (lambda (button) (browse-url "http://www.gnu.org/software/emacs/tour/"))) 1288 (lambda (button) (browse-url "http://www.gnu.org/software/emacs/tour/"))
1289 "Browse http://www.gnu.org/software/emacs/tour/")
1278 "\tSee an overview of the many facilities of GNU Emacs" 1290 "\tSee an overview of the many facilities of GNU Emacs"
1279 )) 1291 ))
1280 "A list of texts to show in the middle part of the About screen. 1292 "A list of texts to show in the middle part of the About screen.
1281 Each element in the list should be a list of strings or pairs 1293 Each element in the list should be a list of strings or pairs
1282 `:face FACE', like `fancy-splash-insert' accepts them.") 1294 `:face FACE', like `fancy-splash-insert' accepts them.")
1312 "Insert text into the current buffer, with faces. 1324 "Insert text into the current buffer, with faces.
1313 Arguments from ARGS should be either strings; functions called 1325 Arguments from ARGS should be either strings; functions called
1314 with no args that return a string; pairs `:face FACE', where FACE 1326 with no args that return a string; pairs `:face FACE', where FACE
1315 is a face specification usable with `put-text-property'; or pairs 1327 is a face specification usable with `put-text-property'; or pairs
1316 `:link LINK' where LINK is a list of arguments to pass to 1328 `:link LINK' where LINK is a list of arguments to pass to
1317 `insert-button', of the form (LABEL ACTION), which specifies the 1329 `insert-button', of the form (LABEL ACTION [HELP-ECHO]), which
1318 button's label and `action' property. FACE and LINK can also be 1330 specifies the button's label, `action' property and help-echo string.
1319 functions, which are evaluated to obtain a face or button 1331 FACE and LINK can also be functions, which are evaluated to obtain
1320 specification." 1332 a face or button specification."
1321 (let ((current-face nil)) 1333 (let ((current-face nil))
1322 (while args 1334 (while args
1323 (cond ((eq (car args) :face) 1335 (cond ((eq (car args) :face)
1324 (setq args (cdr args) current-face (car args)) 1336 (setq args (cdr args) current-face (car args))
1325 (if (functionp current-face) 1337 (if (functionp current-face)
1330 (if (functionp spec) 1342 (if (functionp spec)
1331 (setq spec (funcall spec))) 1343 (setq spec (funcall spec)))
1332 (insert-button (car spec) 1344 (insert-button (car spec)
1333 'face (list 'link current-face) 1345 'face (list 'link current-face)
1334 'action (cadr spec) 1346 'action (cadr spec)
1347 'help-echo (concat "mouse-2, RET: "
1348 (or (nth 2 spec)
1349 "Follow this link"))
1335 'follow-link t))) 1350 'follow-link t)))
1336 (t (insert (propertize (let ((it (car args))) 1351 (t (insert (propertize (let ((it (car args)))
1337 (if (functionp it) 1352 (if (functionp it)
1338 (funcall it) 1353 (funcall it)
1339 it)) 1354 it))
1369 (setq img (append img '(:color-symbols (("#000000" . "gray30")))))) 1384 (setq img (append img '(:color-symbols (("#000000" . "gray30"))))))
1370 1385
1371 ;; Insert the image with a help-echo and a link. 1386 ;; Insert the image with a help-echo and a link.
1372 (make-button (prog1 (point) (insert-image img)) (point) 1387 (make-button (prog1 (point) (insert-image img)) (point)
1373 'face 'default 1388 'face 'default
1374 'help-echo "mouse-2: browse http://www.gnu.org/" 1389 'help-echo "mouse-2, RET: Browse http://www.gnu.org/"
1375 'action (lambda (button) (browse-url "http://www.gnu.org/")) 1390 'action (lambda (button) (browse-url "http://www.gnu.org/"))
1376 'follow-link t) 1391 'follow-link t)
1377 (insert "\n\n"))))) 1392 (insert "\n\n")))))
1378 1393
1379 (defun fancy-startup-tail (&optional concise) 1394 (defun fancy-startup-tail (&optional concise)
1383 (unless concise 1398 (unless concise
1384 (fancy-splash-insert 1399 (fancy-splash-insert
1385 :face 'variable-pitch 1400 :face 'variable-pitch
1386 "\nTo start... " 1401 "\nTo start... "
1387 :link '("Open a File" 1402 :link '("Open a File"
1388 (lambda (button) (call-interactively 'find-file))) 1403 (lambda (button) (call-interactively 'find-file))
1404 "Specify a new file's name, to edit the file")
1389 " " 1405 " "
1390 :link '("Open Home Directory" 1406 :link '("Open Home Directory"
1391 (lambda (button) (dired "~"))) 1407 (lambda (button) (dired "~"))
1408 "Open your home directory, to operate on its files")
1392 " " 1409 " "
1393 :link '("Customize Startup" 1410 :link '("Customize Startup"
1394 (lambda (button) (customize-group 'initialization))) 1411 (lambda (button) (customize-group 'initialization))
1412 "Change initialization settings including this screen")
1395 "\n")) 1413 "\n"))
1396 (fancy-splash-insert :face `(variable-pitch :foreground ,fg) 1414 (fancy-splash-insert :face `(variable-pitch :foreground ,fg)
1397 "\nThis is " 1415 "\nThis is "
1398 (emacs-version) 1416 (emacs-version)
1399 "\n" 1417 "\n"