emacs-devel
[Top][All Lists]
Advanced

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

cus-misc: customize autoloads, environment variables (and key bindings)


From: Simon Josefsson
Subject: cus-misc: customize autoloads, environment variables (and key bindings)
Date: Tue, 20 Apr 2004 21:43:03 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

There were some discussion on cus-misc.el before, and I think one
comment was that the key binding part should use a better widget for
entering keys than the custom "string" widget.  But what do people
think of the other parts?  Autoload cookies and environment variables?
Do anyone think it would be useful to add this to Emacs?  If so, we
could add the following except for the custom-key-alist part, until
someone look into making a better key binding widget.

I just realized adding entries to `load-path' could be made
customizable with this approach as well.  And `auto-mode-alist' is
another example.

;;; cus-misc.el --- Customize key bindings, autoloads and env. variables.
;; Copyright (C) 2003, 2004 Free Software Foundation, Inc.

;; Author: Simon Josefsson <address@hidden>

;; This file is part of GNU Emacs.

;; GNU Emacs 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 2, or (at your option)
;; any later version.

;; GNU Emacs 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 GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; Put this file in your load-path, evaluate it, and run M-x
;; customize-variable RET custom-key-alist RET and add some key
;; bindings, for example:
;;
;; custom-key-alist's value is
;; (("<f5>" . compile)
;;  ("<f6>" . next-error)
;;  ("<f7>" . previous-error)
;;  ("C-x 4h" . gtk-doc-insert))
;;
;; Click on 'Save', and restart Emacs to enjoy the now (hopefully)
;; automagically configured new global key bindings.
;;
;; Similarly, customize `custom-autoload-alist' and
;; `custom-environment-variable-alist' to add autoload cookies and
;; environment variables, respectively.  For example:
;;
;; custom-autoload-alist's value is
;; ((mail-add-payment . "hashcash"))
;;
;; custom-environment-variable-alist's value is
;; (("CVS_RSH" . "ssh"))

;;; History:

;; 2003-12-30 initial release
;; 2003-12-30 second release, fixed comments and added :require to defcustom.
;; 2004-01-04 added autoloads and environment variables,
;;            renamed to cus-misc.el.

(defcustom custom-key-alist nil
  "Association list with key bindings and functions."
  :type '(alist :key-type (string :tag "Key")
                :value-type (function :tag "Command"))
  :set '(lambda (symbol infolist)
          (set-default symbol infolist)
          (mapcar (lambda (info)
                    (global-set-key (read-kbd-macro (car info)) (cdr info)))
                  infolist))
  :require 'cus-misc)

(defcustom custom-autoload-alist nil
  "Association list with autoload definitions to set on startup."
  :type '(alist :key-type (symbol :tag "Function")
                :value-type (string :tag "Elisp file"))
  :set '(lambda (symbol infolist)
          (set-default symbol infolist)
          (mapcar (lambda (info)
                    (autoload (car info) (cdr info)))
                  infolist))
  :require 'cus-misc)

(defcustom custom-environment-variable-alist nil
  "Association list with environment variables to `setenv' on startup."
  :type '(alist :key-type (string :tag "Environment Variable")
                :value-type (string :tag "Value"))
  :set '(lambda (symbol infolist)
          (set-default symbol infolist)
          (mapcar (lambda (info)
                    (setenv (car info) (cdr info)))
                  infolist))
  :require 'cus-misc)

(provide 'cus-misc)

;;; cus-misc.el ends here




reply via email to

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