comparison etc/sample.init.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents ed498ef2108b
children 42375619fa45
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
412 412
413 ;; F6 is invaluable for flipping back and forth between two buffers 413 ;; F6 is invaluable for flipping back and forth between two buffers
414 ;; you're working with. 414 ;; you're working with.
415 415
416 (global-set-key 'f6 'switch-to-other-buffer) ;; M-C-l 416 (global-set-key 'f6 'switch-to-other-buffer) ;; M-C-l
417 (global-set-key '(meta n) 'switch-to-next-buffer-in-group)
418 (global-set-key '(meta p) 'switch-to-previous-buffer-in-group)
419 (global-set-key '(meta N) 'switch-to-next-buffer)
420 (global-set-key '(meta P) 'switch-to-previous-buffer)
421
422 ;; Define our own function to deal with the possibility that the newer
423 ;; stuff in the gutter code may not be present -- i.e. we're running
424 ;; an older XEmacs. Note that we avoid trying to "helpfully" define a
425 ;; function that is present in new versions of XEmacs, but not in
426 ;; older ones. That can very easily screw up code trying to determine
427 ;; what functionality is present using `fboundp' checks. See above,
428 ;; near `emacs-version>=', for a full discussion of this.
429
430 (defun Init-buffers-tab-omit (buf)
431 ;; a function specifying the buffers to omit from the buffers tab.
432 ;; This is passed a buffer and should return non-nil if the buffer
433 ;; should be omitted. If the standard buffers-tab functionality is
434 ;; there, we just call it to do things "right". Otherwise we just
435 ;; omit invisible buffers, snarfing the code from
436 ;; `buffers-menu-omit-invisible-buffers'.
437 (if (boundp 'buffers-tab-omit-function)
438 (funcall buffers-tab-omit-function buf)
439 (not (null (string-match "\\` " (buffer-name buf))))))
440
441 (defun switch-to-next-buffer (&optional n)
442 "Switch to the next-most-recent buffer.
443 This essentially rotates the buffer list forward.
444 N (interactively, the prefix arg) specifies how many times to rotate
445 forward, and defaults to 1. Buffers whose name begins with a space
446 \(i.e. \"invisible\" buffers) are ignored."
447 ;; Here is a different interactive spec. Look up the function
448 ;; `interactive' (i.e. `C-h f interactive') to understand how this
449 ;; all works.
450 (interactive "p")
451 (dotimes (n (or n 1))
452 (loop
453 do (bury-buffer (car (buffer-list)))
454 while (Init-buffers-tab-omit (car (buffer-list))))
455 (switch-to-buffer (car (buffer-list)))))
456
457 (defun buffers-menu-omit-invisible-buffers (buf)
458 "For use as a value of `buffers-menu-omit-function'.
459 Omits normally invisible buffers (those whose name begins with a space)."
460 (not (null (string-match "\\` " (buffer-name buf)))))
461
462 (defvar Init-buffers-tab-grouping-regexp
463 '("^\\(gnus-\\|message-mode\\|mime/viewer-mode\\)"
464 "^\\(emacs-lisp-\\|lisp-\\)")
465 ;; If non-nil, a list of regular expressions for buffer grouping.
466 ;; Each regular expression is applied to the current major-mode symbol
467 ;; name and mode-name, if it matches then any other buffers that match
468 ;; the same regular expression be added to the current group. This is
469 ;; a copy of `buffers-tab-grouping-regexp'.
470 )
471
472 (defun Init-select-buffers-tab-buffers (buffer-to-select buf1)
473 ;; Specifies the buffers to select from the buffers tab. This is
474 ;; passed two buffers and should return non-nil if the second buffer
475 ;; should be selected. If the standard buffers-tab functionality is
476 ;; there, we just call it to do things "right". Otherwise, we group
477 ;; buffers by major mode and by `Init-buffers-tab-grouping-regexp'.
478 ;; [We've copied `select-buffers-tab-buffers-by-mode' and
479 ;; `buffers-tab-grouping-regexp'.]
480 (if (boundp 'buffers-tab-selection-function)
481 (funcall buffers-tab-selection-function buffer-to-select buf1)
482 (let ((mode1 (symbol-name (symbol-value-in-buffer 'major-mode buf1)))
483 (mode2 (symbol-name (symbol-value-in-buffer 'major-mode
484 buffer-to-select)))
485 (modenm1 (symbol-value-in-buffer 'mode-name buf1))
486 (modenm2 (symbol-value-in-buffer 'mode-name buffer-to-select)))
487 (cond ((or (eq mode1 mode2)
488 (eq modenm1 modenm2)
489 (and (string-match "^[^-]+-" mode1)
490 (string-match
491 (concat "^" (regexp-quote
492 (substring mode1 0 (match-end 0))))
493 mode2))
494 (and Init-buffers-tab-grouping-regexp
495 (find-if #'(lambda (x)
496 (or
497 (and (string-match x mode1)
498 (string-match x mode2))
499 (and (string-match x modenm1)
500 (string-match x modenm2))))
501 Init-buffers-tab-grouping-regexp)))
502 t)
503 (t nil)))))
504
505 (defun switch-to-previous-buffer (&optional n)
506 "Switch to the previously most-recent buffer.
507 This essentially rotates the buffer list backward.
508 N (interactively, the prefix arg) specifies how many times to rotate
509 backward, and defaults to 1. Buffers whose name begins with a space
510 \(i.e. \"invisible\" buffers) are ignored."
511 (interactive "p")
512 (dotimes (n (or n 1))
513 (loop
514 do (switch-to-buffer (car (last (buffer-list))))
515 while (Init-buffers-tab-omit (car (buffer-list))))))
516
517 (defun switch-to-next-buffer-in-group (&optional n)
518 "Switch to the next-most-recent buffer in the current group.
519 This essentially rotates the buffer list forward.
520 N (interactively, the prefix arg) specifies how many times to rotate
521 forward, and defaults to 1. Buffers whose name begins with a space
522 \(i.e. \"invisible\" buffers) are ignored."
523 (interactive "p")
524 (dotimes (n (or n 1))
525 (let ((curbuf (car (buffer-list))))
526 (loop
527 do (bury-buffer (car (buffer-list)))
528 while (or (Init-buffers-tab-omit (car (buffer-list)))
529 (not (Init-select-buffers-tab-buffers
530 curbuf (car (buffer-list)))))))
531 (switch-to-buffer (car (buffer-list)))))
532
533 (defun switch-to-previous-buffer-in-group (&optional n)
534 "Switch to the previously most-recent buffer in the current group.
535 This essentially rotates the buffer list backward.
536 N (interactively, the prefix arg) specifies how many times to rotate
537 backward, and defaults to 1. Buffers whose name begins with a space
538 \(i.e. \"invisible\" buffers) are ignored."
539 (interactive "p")
540 (dotimes (n (or n 1))
541 (let ((curbuf (car (buffer-list))))
542 (loop
543 do (switch-to-buffer (car (last (buffer-list))))
544 while (or (Init-buffers-tab-omit (car (buffer-list)))
545 (not (Init-select-buffers-tab-buffers
546 curbuf (car (buffer-list)))))))))
547 417
548 ;;;;;;;;;;;;;;;;;;;;;;;; 418 ;;;;;;;;;;;;;;;;;;;;;;;;
549 419
550 ;; Other text keystrokes. 420 ;; Other text keystrokes.
551 421
603 ;; exits XEmacs. It's easy to hit this by mistake, and that can be 473 ;; exits XEmacs. It's easy to hit this by mistake, and that can be
604 ;; annoying. You can always quit with the "Exit XEmacs" option on the 474 ;; annoying. You can always quit with the "Exit XEmacs" option on the
605 ;; File menu. 475 ;; File menu.
606 476
607 (when (console-on-window-system-p) 477 (when (console-on-window-system-p)
608 (global-set-key "\C-x\C-c" nil)) 478 (global-set-key "\C-x\C-c"
479 #'(lambda () (interactive)
480 (beep)
481 (message "Use the \"File/Exit XEmacs\" menu item to exit XEmacs"))))
609 482
610 ;; Make C-k always delete the whole line, which is what most people want, 483 ;; Make C-k always delete the whole line, which is what most people want,
611 ;; anyway. 484 ;; anyway.
612 (setq kill-whole-line 'always) 485 (setq kill-whole-line 'always)
613 ;; M-k does the old behavior (kill to end of line). 486 ;; M-k does the old behavior (kill to end of line).