unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Experimental features
@ 2007-06-22 21:05 Stefan Monnier
  2007-06-22 21:22 ` Lennart Borgman (gmail)
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Stefan Monnier @ 2007-06-22 21:05 UTC (permalink / raw)
  To: emacs-devel


Release practice during Emacs-21 at least is that new features could only
appear in new major releases, except for a few small exceptions.

I'd like to change that to make released Emacsen evolve faster.
One way to do that would be to introduce the idea of "experimental"
features which could be added to any minor release.

An experimental feature would be disabled by default and the code should be
written in such a way that as long as the feature is enabled, it's clearly
obvious that it cannot have any negative effect.

We'd then provide a way for the user to activate some of the experimental
features from her .emacs file.  After some time, we would promote the new
feature such that it is not experimental any more.


        Stefan

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-22 21:05 Experimental features Stefan Monnier
@ 2007-06-22 21:22 ` Lennart Borgman (gmail)
  2007-06-23  4:15   ` Stefan Monnier
  2007-06-23  2:51 ` dhruva
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 22+ messages in thread
From: Lennart Borgman (gmail) @ 2007-06-22 21:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:
> Release practice during Emacs-21 at least is that new features could only
> appear in new major releases, except for a few small exceptions.
> 
> I'd like to change that to make released Emacsen evolve faster.
> One way to do that would be to introduce the idea of "experimental"
> features which could be added to any minor release.


I like the idea. Maybe the package manager discussed before could come 
in to help here too?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-22 21:05 Experimental features Stefan Monnier
  2007-06-22 21:22 ` Lennart Borgman (gmail)
@ 2007-06-23  2:51 ` dhruva
  2007-06-23  6:00 ` Andreas Röhler
  2007-06-23 13:19 ` Richard Stallman
  3 siblings, 0 replies; 22+ messages in thread
From: dhruva @ 2007-06-23  2:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Hi,

On 6/23/07, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> We'd then provide a way for the user to activate some of the experimental
> features from her .emacs file.  After some time, we would promote the new

This will be a good welcome move. Features get more testing (by
explicitly enabling it in the experimental stage). If an experimental
package is dependent on another experimental package, a mechanism
needs to be evolved on either enabling the other package implicitly
(dangerous) or notify to the user in a very obvious manner (by
offering to bring up the customization page to enable it by the user).

Anyway, this is a move forward. So far, I have been downloading all
scattered packages and using them. I would prefer them to be
distributed as part of Emacs and ability to enable or disable them
optionally.

with best regards,
dhruva

-- 
Dhruva Krishnamurthy
Contents reflect my personal views only!

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-22 21:22 ` Lennart Borgman (gmail)
@ 2007-06-23  4:15   ` Stefan Monnier
  2007-06-23 12:40     ` Thien-Thi Nguyen
  0 siblings, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2007-06-23  4:15 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

> I like the idea.  Maybe the package manager discussed before could come in
> to help here too?

Oh, no, please!  Let's not drag this into it, OK?


        Stefan

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-22 21:05 Experimental features Stefan Monnier
  2007-06-22 21:22 ` Lennart Borgman (gmail)
  2007-06-23  2:51 ` dhruva
@ 2007-06-23  6:00 ` Andreas Röhler
  2007-06-24  1:43   ` T. V. Raman
  2007-06-23 13:19 ` Richard Stallman
  3 siblings, 1 reply; 22+ messages in thread
From: Andreas Röhler @ 2007-06-23  6:00 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier, Richard Stallman

Am Freitag, 22. Juni 2007 23:05 schrieb Stefan Monnier:
> Release practice during Emacs-21 at least is that new features could only
> appear in new major releases, except for a few small exceptions.
>
> I'd like to change that to make released Emacsen evolve faster.
> One way to do that would be to introduce the idea of "experimental"
> features which could be added to any minor release.
>
> An experimental feature would be disabled by default and the code should be
> written in such a way that as long as the feature is enabled, it's clearly
> obvious that it cannot have any negative effect.
>
> We'd then provide a way for the user to activate some of the experimental
> features from her .emacs file.  After some time, we would promote the new
> feature such that it is not experimental any more.
>
>
>         Stefan
>

Very good idea. But let's put the question more
thoroughly: as the realm of computing is vast and
ever expands, you have to give up the
idea to incorporate any valid program into core-Emacs
sooner or later.

Emacs already is unnecessary big for most of the
purposes.  Thus it starts not as quick as others, risks
not to be first choice for calling under certain
circumstances. That's a pity for me, because I prefer
it. Don't want to write any line without it, even not
to my mother. :)

I propose a more slim core emacs coming with an
install-shield, which lets users click features, some
of them may be marked as experimental too.

Given this, I would be glad to see common third-party
features as ESS, ECB, Emacspeak etc. reachable too that
way.

I'm aware this would mean a major work. However, it
must not be done at once. It offers great chances,
because it would ease the use for many people, thus
expanding the number of users.

Andreas Roehler

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23  4:15   ` Stefan Monnier
@ 2007-06-23 12:40     ` Thien-Thi Nguyen
  2007-06-23 19:07       ` Stefan Monnier
  0 siblings, 1 reply; 22+ messages in thread
From: Thien-Thi Nguyen @ 2007-06-23 12:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lennart Borgman (gmail), emacs-devel

() Stefan Monnier <monnier@iro.umontreal.ca>
() Sat, 23 Jun 2007 00:15:06 -0400

   > I like the idea.  Maybe the package manager discussed before
   > could come in to help here too?

   Oh, no, please!  Let's not drag this into it, OK?

it can't be helped.  "experimental" is metadata (label, i.e., boolean
property).  package management is proper metadata management, among
other (logistically-oriented) concerns.

another thing about metadata: if useful, it can be applied to more
things than the original domain.  i.e., if code to be distributed w/
emacs can be labeled "experimental", why not other code outside of
emacs?  how does emacs' semantics for "experimental" interoperate w/
external semantics?  etc.

to be (more) concrete: at the moment, there is only convention:
Commentary comment and w/in it Author, Maintainer, Version "tags".  your
proposal is not simply to suggest adding "Experimental: t" (or perhaps
equivalently "Keywords: ... experimental ...").  it is to codify the
handling of this information w/ user-visible consequences.  when it is
to be treated like so, it is no longer merely conventional.

thus, proper metadata management is again indicated.

thi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-22 21:05 Experimental features Stefan Monnier
                   ` (2 preceding siblings ...)
  2007-06-23  6:00 ` Andreas Röhler
@ 2007-06-23 13:19 ` Richard Stallman
  2007-06-23 13:37   ` Juanma Barranquero
  2007-06-23 19:16   ` Stefan Monnier
  3 siblings, 2 replies; 22+ messages in thread
From: Richard Stallman @ 2007-06-23 13:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

I don't mind adding some new features to minor releases.
We've already added some for Emacs 22.2.
They should be totally modular, though, so that we
know they are safe.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23 13:19 ` Richard Stallman
@ 2007-06-23 13:37   ` Juanma Barranquero
  2007-06-24 14:40     ` Richard Stallman
  2007-06-23 19:16   ` Stefan Monnier
  1 sibling, 1 reply; 22+ messages in thread
From: Juanma Barranquero @ 2007-06-23 13:37 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On 6/23/07, Richard Stallman <rms@gnu.org> wrote:

> I don't mind adding some new features to minor releases.
> We've already added some for Emacs 22.2.
> They should be totally modular, though, so that we
> know they are safe.

BTW, if the release of 22.2 isn't imminent, I'd like to offer Davis
Herring's desktop locking feature for inclusion in 22.2 (it's already
in the trunk).

It's a small change (it seems bigger because a big bunch of code was
factored out to a function, and also I changed a few one-armed `if's
to `when's) and pretty safe.

             Juanma



2007-06-20  Juanma Barranquero  <lekktu@gmail.com>

	* desktop.el (desktop-read): Run `desktop-not-loaded-hook' in the
	directory where the desktop file was found, as the docstring says.
	(desktop-kill): Use `read-directory-name'.

2007-06-12  Juanma Barranquero  <lekktu@gmail.com>

	* desktop.el (desktop-load-locked-desktop): New option.
	(desktop-read): Use it.
	(desktop-truncate, desktop-outvar, desktop-restore-file-buffer):
	Use `when'.

2007-06-12  Davis Herring  <herring@lanl.gov>

	* desktop.el (desktop-save-mode-off): New function.
	(desktop-base-lock-name, desktop-not-loaded-hook): New variables.
	(desktop-full-lock-name, desktop-file-modtime, desktop-owner)
	(desktop-claim-lock, desktop-release-lock): New functions.
	(desktop-kill): Tell `desktop-save' that this is the last save.
	Release the lock afterwards.
	(desktop-buffer-info): New function.
	(desktop-save): Use it.  Run `desktop-save-hook' where the doc
	says to.  Detect conflicts, and manage the lock.
	(desktop-read): Detect conflicts.  Manage the lock.



Index: lisp/desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.108.2.1
diff -c -b -r1.108.2.1 desktop.el
*** lisp/desktop.el	9 Jun 2007 00:10:38 -0000	1.108.2.1
--- lisp/desktop.el	23 Jun 2007 13:29:16 -0000
***************
*** 162,167 ****
--- 162,171 ----
  (define-obsolete-variable-alias 'desktop-enable
                                  'desktop-save-mode "22.1")

+ (defun desktop-save-mode-off ()
+   "Disable `desktop-save-mode'.  Provided for use in hooks."
+   (desktop-save-mode 0))
+
  (defcustom desktop-save 'ask-if-new
    "*Specifies whether the desktop should be saved when it is killed.
  A desktop is killed when the user changes desktop or quits Emacs.
***************
*** 186,191 ****
--- 190,211 ----
    :group 'desktop
    :version "22.1")

+ (defcustom desktop-load-locked-desktop 'ask
+   "Specifies whether the desktop should be loaded if locked.
+ Possible values are:
+    t    -- load anyway.
+    nil  -- don't load.
+    ask  -- ask the user.
+ If the value is nil, or `ask' and the user chooses not to load the desktop,
+ the normal hook `desktop-not-loaded-hook' is run."
+   :type
+   '(choice
+     (const :tag "Load anyway" t)
+     (const :tag "Don't load" nil)
+     (const :tag "Ask the user" ask))
+   :group 'desktop
+   :version "22.2")
+
  (defcustom desktop-base-file-name
    (convert-standard-filename ".emacs.desktop")
    "Name of file for Emacs desktop, excluding the directory part."
***************
*** 194,199 ****
--- 214,226 ----
  (define-obsolete-variable-alias 'desktop-basefilename
                                  'desktop-base-file-name "22.1")

+ (defcustom desktop-base-lock-name
+   (convert-standard-filename ".emacs.desktop.lock")
+   "Name of lock file for Emacs desktop, excluding the directory part."
+   :type 'file
+   :group 'desktop
+   :version "22.2")
+
  (defcustom desktop-path '("." "~")
    "List of directories to search for the desktop file.
  The base name of the file is specified in `desktop-base-file-name'."
***************
*** 219,224 ****
--- 246,260 ----
    :group 'desktop
    :version "22.1")

+ (defcustom desktop-not-loaded-hook nil
+   "Normal hook run when the user declines to re-use a desktop file.
+ Run in the directory in which the desktop file was found.
+ May be used to deal with accidental multiple Emacs jobs."
+   :type 'hook
+   :group 'desktop
+   :options '(desktop-save-mode-off save-buffers-kill-emacs)
+   :version "22.2")
+
  (defcustom desktop-after-read-hook nil
    "Normal hook run after a successful `desktop-read'.
  May be used to show a buffer list."
***************
*** 486,491 ****
--- 522,532 ----
  DIRNAME omitted or nil means use `desktop-dirname'."
    (expand-file-name desktop-base-file-name (or dirname desktop-dirname)))

+ (defun desktop-full-lock-name (&optional dirname)
+   "Return the full name of the desktop lock file in DIRNAME.
+ DIRNAME omitted or nil means use `desktop-dirname'."
+   (expand-file-name desktop-base-lock-name (or dirname desktop-dirname)))
+
  (defconst desktop-header
  ";; --------------------------------------------------------------------------
  ;; Desktop File for Emacs
***************
*** 496,505 ****
    "Hooks run after all buffers are loaded; intended for internal use.")

  ;; ----------------------------------------------------------------------------
  (defun desktop-truncate (list n)
    "Truncate LIST to at most N elements destructively."
    (let ((here (nthcdr (1- n) list)))
!     (if (consp here)
  	(setcdr here nil))))

  ;; ----------------------------------------------------------------------------
--- 537,579 ----
    "Hooks run after all buffers are loaded; intended for internal use.")

  ;; ----------------------------------------------------------------------------
+ ;; Desktop file conflict detection
+ (defvar desktop-file-modtime nil
+   "When the desktop file was last modified to the knowledge of this Emacs.
+ Used to detect desktop file conflicts.")
+
+ (defun desktop-owner (&optional dirname)
+   "Return the PID of the Emacs process that owns the desktop file in DIRNAME.
+ Return nil if no desktop file found or no Emacs process is using it.
+ DIRNAME omitted or nil means use `desktop-dirname'."
+   (let (owner)
+     (and (file-exists-p (desktop-full-lock-name dirname))
+ 	 (condition-case nil
+ 	     (with-temp-buffer
+ 	       (insert-file-contents-literally (desktop-full-lock-name dirname))
+ 	       (goto-char (point-min))
+ 	       (setq owner (read (current-buffer)))
+ 	       (integerp owner))
+ 	   (error nil))
+ 	 owner)))
+
+ (defun desktop-claim-lock (&optional dirname)
+   "Record this Emacs process as the owner of the desktop file in DIRNAME.
+ DIRNAME omitted or nil means use `desktop-dirname'."
+   (write-region (number-to-string (emacs-pid)) nil
+ 		(desktop-full-lock-name dirname)))
+
+ (defun desktop-release-lock (&optional dirname)
+   "Remove the lock file for the desktop in DIRNAME.
+ DIRNAME omitted or nil means use `desktop-dirname'."
+   (let ((file (desktop-full-lock-name dirname)))
+     (when (file-exists-p file) (delete-file file))))
+
+ ;; ----------------------------------------------------------------------------
  (defun desktop-truncate (list n)
    "Truncate LIST to at most N elements destructively."
    (let ((here (nthcdr (1- n) list)))
!     (when (consp here)
        (setcdr here nil))))

  ;; ----------------------------------------------------------------------------
***************
*** 552,565 ****
        (setq desktop-dirname
              (file-name-as-directory
               (expand-file-name
!               (call-interactively
!                (lambda (dir)
!                  (interactive "DDirectory for desktop file: ") dir))))))
      (condition-case err
!         (desktop-save desktop-dirname)
        (file-error
         (unless (yes-or-no-p "Error while saving the desktop.  Ignore? ")
!          (signal (car err) (cdr err)))))))

  ;; ----------------------------------------------------------------------------
  (defun desktop-list* (&rest args)
--- 626,639 ----
        (setq desktop-dirname
              (file-name-as-directory
               (expand-file-name
! 	      (read-directory-name "Directory for desktop file: " nil nil t)))))
      (condition-case err
! 	(desktop-save desktop-dirname t)
        (file-error
         (unless (yes-or-no-p "Error while saving the desktop.  Ignore? ")
! 	 (signal (car err) (cdr err))))))
!   ;; If we own it, we don't anymore.
!   (when (eq (emacs-pid) (desktop-owner)) (desktop-release-lock)))

  ;; ----------------------------------------------------------------------------
  (defun desktop-list* (&rest args)
***************
*** 574,579 ****
--- 648,693 ----
        value)))

  ;; ----------------------------------------------------------------------------
+ (defun desktop-buffer-info (buffer)
+   (set-buffer buffer)
+   (list
+    ;; basic information
+    (desktop-file-name (buffer-file-name) dirname)
+    (buffer-name)
+    major-mode
+    ;; minor modes
+    (let (ret)
+      (mapc
+       #'(lambda (minor-mode)
+ 	  (and (boundp minor-mode)
+ 	       (symbol-value minor-mode)
+ 	       (let* ((special (assq minor-mode desktop-minor-mode-table))
+ 		      (value (cond (special (cadr special))
+ 				   ((functionp minor-mode) minor-mode))))
+ 		 (when value (add-to-list 'ret value)))))
+       (mapcar #'car minor-mode-alist))
+      ret)
+    ;; point and mark, and read-only status
+    (point)
+    (list (mark t) mark-active)
+    buffer-read-only
+    ;; auxiliary information
+    (when (functionp desktop-save-buffer)
+      (funcall desktop-save-buffer dirname))
+    ;; local variables
+    (let ((locals desktop-locals-to-save)
+ 	 (loclist (buffer-local-variables))
+ 	 (ll))
+      (while locals
+        (let ((here (assq (car locals) loclist)))
+ 	 (if here
+ 	     (setq ll (cons here ll))
+ 	   (when (member (car locals) loclist)
+ 	     (setq ll (cons (car locals) ll)))))
+        (setq locals (cdr locals)))
+      ll)))
+
+ ;; ----------------------------------------------------------------------------
  (defun desktop-internal-v2s (value)
    "Convert VALUE to a pair (QUOTE . TXT); (eval (read TXT)) gives VALUE.
  TXT is a string that when read and evaluated yields value.
***************
*** 676,684 ****
      (if (consp varspec)
  	(setq var (car varspec) size (cdr varspec))
        (setq var varspec))
!     (if (boundp var)
! 	(progn
! 	  (if (and (integerp size)
  		   (> size 0)
  		   (listp (eval var)))
  	      (desktop-truncate (eval var) size))
--- 790,797 ----
      (if (consp varspec)
  	(setq var (car varspec) size (cdr varspec))
        (setq var varspec))
!     (when (boundp var)
!       (when (and (integerp size)
  		 (> size 0)
  		 (listp (eval var)))
  	(desktop-truncate (eval var) size))
***************
*** 686,692 ****
  		  (symbol-name var)
  		  " "
  		  (desktop-value-to-string (symbol-value var))
! 		  ")\n")))))

  ;; ----------------------------------------------------------------------------
  (defun desktop-save-buffer-p (filename bufname mode &rest dummy)
--- 799,805 ----
  	      (symbol-name var)
  	      " "
  	      (desktop-value-to-string (symbol-value var))
! 	      ")\n"))))

  ;; ----------------------------------------------------------------------------
  (defun desktop-save-buffer-p (filename bufname mode &rest dummy)
***************
*** 724,802 ****

  ;; ----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-save (dirname)
    "Save the desktop in a desktop file.
  Parameter DIRNAME specifies where to save the desktop file.
  See also `desktop-base-file-name'."
    (interactive "DDirectory to save desktop file in: ")
!   (run-hooks 'desktop-save-hook)
!   (setq dirname (file-name-as-directory (expand-file-name dirname)))
    (save-excursion
!     (let ((filename (desktop-full-file-name dirname))
!           (info
!             (mapcar
!               #'(lambda (b)
!                   (set-buffer b)
!                   (list
!                     (desktop-file-name (buffer-file-name) dirname)
!                     (buffer-name)
!                     major-mode
!                     ;; minor modes
!                     (let (ret)
!                       (mapc
!                         #'(lambda (minor-mode)
!                           (and
!                             (boundp minor-mode)
!                             (symbol-value minor-mode)
!                             (let* ((special (assq minor-mode
desktop-minor-mode-table))
!                                    (value (cond (special (cadr special))
!                                                 ((functionp
minor-mode) minor-mode))))
!                               (when value (add-to-list 'ret value)))))
!                         (mapcar #'car minor-mode-alist))
!                       ret)
!                     (point)
!                     (list (mark t) mark-active)
!                     buffer-read-only
!                     ;; Auxiliary information
!                     (when (functionp desktop-save-buffer)
!                       (funcall desktop-save-buffer dirname))
!                     (let ((locals desktop-locals-to-save)
!                           (loclist (buffer-local-variables))
!                           (ll))
!                       (while locals
!                         (let ((here (assq (car locals) loclist)))
!                           (if here
!                             (setq ll (cons here ll))
!                             (when (member (car locals) loclist)
!                               (setq ll (cons (car locals) ll)))))
!                         (setq locals (cdr locals)))
!                       ll)))
!               (buffer-list)))
!           (eager desktop-restore-eager))
        (with-temp-buffer
          (insert
           ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
           desktop-header
           ";; Created " (current-time-string) "\n"
           ";; Desktop file format version " desktop-file-version "\n"
!          ";; Emacs version " emacs-version "\n\n"
!          ";; Global section:\n")
!         (dolist (varspec desktop-globals-to-save)
!           (desktop-outvar varspec))
!         (if (memq 'kill-ring desktop-globals-to-save)
              (insert
               "(setq kill-ring-yank-pointer (nthcdr "
               (int-to-string (- (length kill-ring) (length
kill-ring-yank-pointer)))
               " kill-ring))\n"))

          (insert "\n;; Buffer section -- buffers listed in same order
as in buffer list:\n")
!         (dolist (l info)
            (when (apply 'desktop-save-buffer-p l)
              (insert "("
                      (if (or (not (integerp eager))
!                             (unless (zerop eager)
!                               (setq eager (1- eager))
!                               t))
                          "desktop-create-buffer"
                        "desktop-append-buffer-args")
                      " "
--- 837,893 ----

  ;; ----------------------------------------------------------------------------
  ;;;###autoload
! (defun desktop-save (dirname &optional release)
    "Save the desktop in a desktop file.
  Parameter DIRNAME specifies where to save the desktop file.
+ Optional parameter RELEASE says whether we're done with this desktop.
  See also `desktop-base-file-name'."
    (interactive "DDirectory to save desktop file in: ")
!   (setq desktop-dirname (file-name-as-directory (expand-file-name dirname)))
    (save-excursion
!     (let ((eager desktop-restore-eager)
! 	  (new-modtime (nth 5 (file-attributes (desktop-full-file-name)))))
!       (when
! 	  (or (not new-modtime)		; nothing to overwrite
! 	      (equal desktop-file-modtime new-modtime)
! 	      (yes-or-no-p (if desktop-file-modtime
! 			       (if (> (float-time new-modtime) (float-time desktop-file-modtime))
! 				   "Desktop file is more recent than the one loaded.  Save anyway? "
! 				 "Desktop file isn't the one loaded.  Overwrite it? ")
! 			     "Current desktop was not loaded from a file.  Overwrite this
desktop file? "))
! 	      (unless release (error "Desktop file conflict")))
!
! 	;; If we're done with it, release the lock.
! 	;; Otherwise, claim it if it's unclaimed or if we created it.
! 	(if release
! 	    (desktop-release-lock)
! 	  (unless (and new-modtime (desktop-owner)) (desktop-claim-lock)))
!
  	(with-temp-buffer
  	  (insert
  	   ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
  	   desktop-header
  	   ";; Created " (current-time-string) "\n"
  	   ";; Desktop file format version " desktop-file-version "\n"
! 	   ";; Emacs version " emacs-version "\n")
! 	  (save-excursion (run-hooks 'desktop-save-hook))
! 	  (goto-char (point-max))
! 	  (insert "\n;; Global section:\n")
! 	  (mapc (function desktop-outvar) desktop-globals-to-save)
! 	  (when (memq 'kill-ring desktop-globals-to-save)
  	    (insert
  	     "(setq kill-ring-yank-pointer (nthcdr "
  	     (int-to-string (- (length kill-ring) (length kill-ring-yank-pointer)))
  	     " kill-ring))\n"))

  	  (insert "\n;; Buffer section -- buffers listed in same order as
in buffer list:\n")
! 	  (dolist (l (mapcar 'desktop-buffer-info (buffer-list)))
  	    (when (apply 'desktop-save-buffer-p l)
  	      (insert "("
  		      (if (or (not (integerp eager))
! 			      (if (zerop eager)
! 				  nil
! 				(setq eager (1- eager))))
  			  "desktop-create-buffer"
  			"desktop-append-buffer-args")
  		      " "
***************
*** 804,813 ****
              (dolist (e l)
                (insert "\n  " (desktop-value-to-string e)))
              (insert ")\n\n")))
          (setq default-directory dirname)
          (let ((coding-system-for-write 'emacs-mule))
!           (write-region (point-min) (point-max) filename nil 'nomessage)))))
!   (setq desktop-dirname dirname))

  ;; ----------------------------------------------------------------------------
  ;;;###autoload
--- 895,906 ----
  	      (dolist (e l)
  		(insert "\n  " (desktop-value-to-string e)))
  	      (insert ")\n\n")))
+
  	  (setq default-directory dirname)
  	  (let ((coding-system-for-write 'emacs-mule))
! 	    (write-region (point-min) (point-max) (desktop-full-file-name)
nil 'nomessage))
! 	  ;; We remember when it was modified (which is presumably just now).
! 	  (setq desktop-file-modtime (nth 5 (file-attributes
(desktop-full-file-name)))))))))

  ;; ----------------------------------------------------------------------------
  ;;;###autoload
***************
*** 856,873 ****
               ;; Default: Home directory.
               "~"))))
      (if (file-exists-p (desktop-full-file-name))
!       ;; Desktop file found, process it.
        (let ((desktop-first-buffer nil)
              (desktop-buffer-ok-count 0)
              (desktop-buffer-fail-count 0)
              ;; Avoid desktop saving during evaluation of desktop buffer.
  	    (desktop-save nil))
  	(desktop-lazy-abort)
!         ;; Evaluate desktop buffer.
          (load (desktop-full-file-name) t t t)
          ;; `desktop-create-buffer' puts buffers at end of the buffer list.
!         ;; We want buffers existing prior to evaluating the desktop
(and not reused)
!         ;; to be placed at the end of the buffer list, so we move them here.
          (mapc 'bury-buffer
                (nreverse (cdr (memq desktop-first-buffer (nreverse
(buffer-list))))))
          (switch-to-buffer (car (buffer-list)))
--- 949,987 ----
               ;; Default: Home directory.
               "~"))))
      (if (file-exists-p (desktop-full-file-name))
! 	;; Desktop file found, but is it already in use?
  	(let ((desktop-first-buffer nil)
  	      (desktop-buffer-ok-count 0)
  	      (desktop-buffer-fail-count 0)
+ 	      (owner (desktop-owner))
  	      ;; Avoid desktop saving during evaluation of desktop buffer.
  	      (desktop-save nil))
+ 	  (if (and owner
+ 		   (memq desktop-load-locked-desktop '(nil ask))
+ 		   (or (null desktop-load-locked-desktop)
+ 		       (not (y-or-n-p (format "Warning: desktop file appears to be
in use by PID %s.\n\
+ Using it may cause conflicts.  Use it anyway? " owner)))))
+ 	      (progn
+ 		(let ((default-directory desktop-dirname))
+ 		  (run-hooks 'desktop-not-loaded-hook))
+ 		(setq desktop-dirname nil)
+ 		(message "Desktop file in use; not loaded."))
  	    (desktop-lazy-abort)
! 	    ;; Evaluate desktop buffer and remember when it was modified.
  	    (load (desktop-full-file-name) t t t)
+ 	    (setq desktop-file-modtime (nth 5 (file-attributes
(desktop-full-file-name))))
+ 	    ;; If it wasn't already, mark it as in-use, to bother other
+ 	    ;; desktop instances.
+ 	    (unless owner
+ 	      (condition-case nil
+ 		  (desktop-claim-lock)
+ 		(file-error (message "Couldn't record use of desktop file")
+ 			    (sit-for 1))))
+
  	    ;; `desktop-create-buffer' puts buffers at end of the buffer list.
! 	    ;; We want buffers existing prior to evaluating the desktop (and
! 	    ;; not reused) to be placed at the end of the buffer list, so we
! 	    ;; move them here.
  	    (mapc 'bury-buffer
  		  (nreverse (cdr (memq desktop-first-buffer (nreverse (buffer-list))))))
  	    (switch-to-buffer (car (buffer-list)))
***************
*** 884,890 ****
                       (format ", %d to restore lazily"
                               (length desktop-buffer-args-list))
                     ""))
!         t)
        ;; No desktop file found.
        (desktop-clear)
        (let ((default-directory desktop-dirname))
--- 998,1004 ----
  			 (format ", %d to restore lazily"
  				 (length desktop-buffer-args-list))
  		       ""))
! 	    t))
        ;; No desktop file found.
        (desktop-clear)
        (let ((default-directory desktop-dirname))
***************
*** 946,952 ****
                                      desktop-buffer-name
                                      desktop-buffer-misc)
    "Restore a file buffer."
!   (if desktop-buffer-file-name
        (if (or (file-exists-p desktop-buffer-file-name)
                (let ((msg (format "Desktop: File \"%s\" no longer exists."
                                   desktop-buffer-file-name)))
--- 1060,1066 ----
                                      desktop-buffer-name
                                      desktop-buffer-misc)
    "Restore a file buffer."
!   (when desktop-buffer-file-name
      (if (or (file-exists-p desktop-buffer-file-name)
  	    (let ((msg (format "Desktop: File \"%s\" no longer exists."
  			       desktop-buffer-file-name)))
***************
*** 1067,1073 ****
                (setq mark-active (car (cdr desktop-buffer-mark))))
              (set-mark desktop-buffer-mark)))
          ;; Never override file system if the file really is read-only marked.
!         (if desktop-buffer-read-only (setq buffer-read-only
desktop-buffer-read-only))
          (while desktop-buffer-locals
            (let ((this (car desktop-buffer-locals)))
              (if (consp this)
--- 1181,1187 ----
  		(setq mark-active (car (cdr desktop-buffer-mark))))
              (set-mark desktop-buffer-mark)))
          ;; Never override file system if the file really is read-only marked.
!         (when desktop-buffer-read-only (setq buffer-read-only
desktop-buffer-read-only))
          (while desktop-buffer-locals
            (let ((this (car desktop-buffer-locals)))
              (if (consp this)

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23 12:40     ` Thien-Thi Nguyen
@ 2007-06-23 19:07       ` Stefan Monnier
  0 siblings, 0 replies; 22+ messages in thread
From: Stefan Monnier @ 2007-06-23 19:07 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: Lennart Borgman (gmail), emacs-devel

>> I like the idea.  Maybe the package manager discussed before
>> could come in to help here too?
>    Oh, no, please!  Let's not drag this into it, OK?
> it can't be helped.

Oh, yes, it can.  We did not need a package manager to introduce the notion
of "obsolete" features.  Similarly we do not need a package manager to
introduce the notion of "experimental" features.

Furthermore feature!=package.

I guess it's all my fault.  I should have sent a patch rather than just
text, that was stupid of me.

People are thinking of a bug package manager, when I'm just thinking of
a minor change to autoload.el plus a custom variable (together with
an adjustment of policy w.r.t minor releases).


        Stefan

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23 13:19 ` Richard Stallman
  2007-06-23 13:37   ` Juanma Barranquero
@ 2007-06-23 19:16   ` Stefan Monnier
  2007-06-24 14:41     ` Richard Stallman
  1 sibling, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2007-06-23 19:16 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

> I don't mind adding some new features to minor releases.

I know, but I think for example that the vc-bzr.el and vc-hg.el (and
potentially others, I hope we'll get vc-darcs.el soon) are somewhat
dangerous to add to Emacs-22.[23...] unless we disable them by default:
they're not 100% modular since they normally get involved every time we open
a file (in 99% of the cases they'll just bail saying that they're not
interested in this file, but still).

So just like we have obsolete features, we could have experimental features,
which are completely deactivated by default but can easily be activated by
the user.  This might allow us to safely include a few more new features in
minor releases.

> We've already added some for Emacs 22.2.  They should be totally modular,
> though, so that we know they are safe.

I'll send a patch soon, to give a more concrete idea of my I'm thinking of.
Basically, I currently picture it as adding something like a function
(activate-experimental-feature <feature>).  And this
`activate-experimental-feature' would simply check for a function
`activate-experimental-feature-<feature>' and call it if it exists (and
otherwise do nothing).  Additionally, we would add a file-local variable
"experimental-feature" to Elisp files which would cause `autoload.el' to
wrap all the autoloads of this file into a function called
`activate-experimental-feature-<feature>'.


        Stefan

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23  6:00 ` Andreas Röhler
@ 2007-06-24  1:43   ` T. V. Raman
  2007-06-24  3:02     ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: T. V. Raman @ 2007-06-24  1:43 UTC (permalink / raw)
  To: andreas.roehler; +Cc: monnier, rms, emacs-devel


The other advantage in doing what you suggest is that external
packages can evolve more rapidly than Emacs.

Including things with core emacs is primarily a user convenience;
but that then becomes an inconvenience if core Emacs includes an
older version of an external package, because, now the user has
to know to grab the unbundled package and install it such that it
shadows what is bundled with Emacs. Thus, I believe:

A)      Core Emacs should unbundle --- not bundle more packages
B)      Core Emacs needs a light-weight means for users to
discover and incorporate additional esxternal packages into their site.

>>>>> "Andreas" == Andreas Röhler <andreas.roehler@online.de> writes:
    Andreas> Am Freitag, 22. Juni 2007 23:05 schrieb Stefan
    Andreas> Monnier:
    >> Release practice during Emacs-21 at least is that new
    >> features could only appear in new major releases, except
    >> for a few small exceptions.
    >> 
    >> I'd like to change that to make released Emacsen evolve
    >> faster.  One way to do that would be to introduce the idea
    >> of "experimental" features which could be added to any
    >> minor release.
    >> 
    >> An experimental feature would be disabled by default and
    >> the code should be written in such a way that as long as
    >> the feature is enabled, it's clearly obvious that it
    >> cannot have any negative effect.
    >> 
    >> We'd then provide a way for the user to activate some of
    >> the experimental features from her .emacs file.  After
    >> some time, we would promote the new feature such that it
    >> is not experimental any more.
    >> 
    >> 
    >> Stefan
    >> 
    Andreas> 
Very good idea. But let's put the question more thoroughly: as
    Andreas> the realm of computing is vast and ever expands, you
    Andreas> have to give up the idea to incorporate any valid
    Andreas> program into core-Emacs sooner or later.
    Andreas> 
    Andreas> Emacs already is unnecessary big for most of the
    Andreas> purposes.  Thus it starts not as quick as others,
    Andreas> risks not to be first choice for calling under
    Andreas> certain circumstances. That's a pity for me, because
    Andreas> I prefer it. Don't want to write any line without
    Andreas> it, even not to my mother. :)
    Andreas> 
    Andreas> I propose a more slim core emacs coming with an
    Andreas> install-shield, which lets users click features,
    Andreas> some of them may be marked as experimental too.
    Andreas> 
    Andreas> Given this, I would be glad to see common
    Andreas> third-party features as ESS, ECB, Emacspeak
    Andreas> etc. reachable too that way.
    Andreas> 
    Andreas> I'm aware this would mean a major work. However, it
    Andreas> must not be done at once. It offers great chances,
    Andreas> because it would ease the use for many people, thus
    Andreas> expanding the number of users.
    Andreas> 
    Andreas> Andreas Roehler
    Andreas> 
    Andreas> 
    Andreas> _______________________________________________
    Andreas> Emacs-devel mailing list Emacs-devel@gnu.org
    Andreas> http://lists.gnu.org/mailman/listinfo/emacs-devel

--
Best Regards,
--raman


Email:  raman@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman
IRC:    irc://irc.freenode.net/#emacs

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24  1:43   ` T. V. Raman
@ 2007-06-24  3:02     ` Eli Zaretskii
  2007-06-24  3:59       ` T. V. Raman
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2007-06-24  3:02 UTC (permalink / raw)
  To: raman; +Cc: andreas.roehler, emacs-devel

> Date: Sat, 23 Jun 2007 18:43:34 -0700
> From: "T. V. Raman" <raman@users.sf.net>
> Cc: monnier@iro.umontreal.ca, rms@gnu.org, emacs-devel@gnu.org
> 
> The other advantage in doing what you suggest is that external
> packages can evolve more rapidly than Emacs.

Why is that an advantage?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24  3:02     ` Eli Zaretskii
@ 2007-06-24  3:59       ` T. V. Raman
  2007-06-24 18:42         ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: T. V. Raman @ 2007-06-24  3:59 UTC (permalink / raw)
  To: eliz; +Cc: emacs-devel, andreas.roehler, raman


That is an advantage because as we have seen with the transition
from emacs 21.4 to 22, it takes a *long* time for   a major Emacs
version to come out --- and with good reason, since stability of
Emacs is important to all of us.

But that also means that smaller packages will --- and *should*
be allowed to --- evolve faster.

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
    >> Date: Sat, 23 Jun 2007 18:43:34 -0700 From: "T. V. Raman"
    >> <raman@users.sf.net> Cc: monnier@iro.umontreal.ca,
    >> rms@gnu.org, emacs-devel@gnu.org
    >> 
    >> The other advantage in doing what you suggest is that
    >> external packages can evolve more rapidly than Emacs.
    Eli> 
    Eli> Why is that an advantage?

-- 
Best Regards,
--raman

      
Email:  raman@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman 
IRC:    irc://irc.freenode.net/#emacs

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23 13:37   ` Juanma Barranquero
@ 2007-06-24 14:40     ` Richard Stallman
  2007-06-24 14:53       ` Juanma Barranquero
  0 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-06-24 14:40 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: emacs-devel

    BTW, if the release of 22.2 isn't imminent, I'd like to offer Davis
    Herring's desktop locking feature for inclusion in 22.2 (it's already
    in the trunk).

If it has been used by several people in the trunk, and thus
tested, then it is ok to put this in Emacs 22.2.
Would you, please?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-23 19:16   ` Stefan Monnier
@ 2007-06-24 14:41     ` Richard Stallman
  2007-06-24 19:23       ` Stefan Monnier
  0 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-06-24 14:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

    I know, but I think for example that the vc-bzr.el and vc-hg.el (and
    potentially others, I hope we'll get vc-darcs.el soon) are somewhat
    dangerous to add to Emacs-22.[23...] unless we disable them by default:
    they're not 100% modular since they normally get involved every time we open
    a file (in 99% of the cases they'll just bail saying that they're not
    interested in this file, but still).

    So just like we have obsolete features, we could have experimental features,
    which are completely deactivated by default but can easily be activated by
    the user.  This might allow us to safely include a few more new features in
    minor releases.

I see the point; maybe so.

    I'll send a patch soon, to give a more concrete idea of my I'm thinking of.
    Basically, I currently picture it as adding something like a function
    (activate-experimental-feature <feature>).

What is the benefit of this, over having a simple variable to control it?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24 14:40     ` Richard Stallman
@ 2007-06-24 14:53       ` Juanma Barranquero
  2007-06-24 19:25         ` Stefan Monnier
  0 siblings, 1 reply; 22+ messages in thread
From: Juanma Barranquero @ 2007-06-24 14:53 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On 6/24/07, Richard Stallman <rms@gnu.org> wrote:

> If it has been used by several people in the trunk, and thus
> tested, then it is ok to put this in Emacs 22.2.

There have been no problems so far.

> Would you, please?

If we're not going to roll 22.2 immediately, I'd like to wait. I don't
expect any problem, but if one appears I prefer to fix it in one place
instead of two :)

             Juanma

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24  3:59       ` T. V. Raman
@ 2007-06-24 18:42         ` Eli Zaretskii
  0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2007-06-24 18:42 UTC (permalink / raw)
  To: raman; +Cc: raman, andreas.roehler, emacs-devel

> Date: Sat, 23 Jun 2007 20:59:21 -0700
> From: "T. V. Raman" <raman@users.sf.net>
> Cc: emacs-devel@gnu.org, andreas.roehler@online.de, raman@users.sourceforge.net
> 
> That is an advantage because as we have seen with the transition
> from emacs 21.4 to 22, it takes a *long* time for   a major Emacs
> version to come out --- and with good reason, since stability of
> Emacs is important to all of us.

That is a reason to make Emacs releases shorter, not to release
packages separately.

> But that also means that smaller packages will --- and *should*
> be allowed to --- evolve faster.

I don't quite see the logic of this conclusion.  If Emacs must be
stable, so do the packages that come with it.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24 14:41     ` Richard Stallman
@ 2007-06-24 19:23       ` Stefan Monnier
  2007-06-24 23:47         ` Richard Stallman
  0 siblings, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2007-06-24 19:23 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     I know, but I think for example that the vc-bzr.el and vc-hg.el (and
>     potentially others, I hope we'll get vc-darcs.el soon) are somewhat
>     dangerous to add to Emacs-22.[23...] unless we disable them by
>     default: they're not 100% modular since they normally get involved
>     every time we open a file (in 99% of the cases they'll just bail
>     saying that they're not interested in this file, but still).

>     So just like we have obsolete features, we could have experimental
>     features, which are completely deactivated by default but can easily
>     be activated by the user.  This might allow us to safely include a few
>     more new features in minor releases.

> I see the point; maybe so.

>     I'll send a patch soon, to give a more concrete idea of my I'm
>     thinking of.  Basically, I currently picture it as adding something
>     like a function (activate-experimental-feature <feature>).

> What is the benefit of this, over having a simple variable to control it?

There are a few issues:
1 - sometimes a single `setq' is not enough to activate a feature.
2 - I like the idea of being able to list the experimental features.


        Stefan

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24 14:53       ` Juanma Barranquero
@ 2007-06-24 19:25         ` Stefan Monnier
  0 siblings, 0 replies; 22+ messages in thread
From: Stefan Monnier @ 2007-06-24 19:25 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: rms, emacs-devel

>> If it has been used by several people in the trunk, and thus
>> tested, then it is ok to put this in Emacs 22.2.

> There have been no problems so far.

>> Would you, please?

> If we're not going to roll 22.2 immediately, I'd like to wait. I don't
> expect any problem, but if one appears I prefer to fix it in one place
> instead of two :)

The release branch is regularly merged back into the trunk (when Miles isn't
on vacation, that is ;-), so there's still only one place to fix it: on the
release branch.


        Stefan

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24 19:23       ` Stefan Monnier
@ 2007-06-24 23:47         ` Richard Stallman
  2007-06-28 18:51           ` Stefan Monnier
  0 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2007-06-24 23:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

    1 - sometimes a single `setq' is not enough to activate a feature.

That is true, but I don't see that this means we need a special
framework for these features.

    2 - I like the idea of being able to list the experimental features.

I think NEWS is good enough for that.


I think that making a feature experimental is really a matter for us,
the developers.

If a feature is a self-contained major mode, and certainly won't
affect anyone that doesn't enable that mode, that is automatically
safe to try installing.  So we can just install it with nothing
special.

But if feature involves adding code in some existing files, files
which have other purposes and uses, that added code might break
something.  So we might want to add an explicit conditional around
each piece of code added in other files, so that we KNOW this feature
can't break anything if you don't enable it.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-24 23:47         ` Richard Stallman
@ 2007-06-28 18:51           ` Stefan Monnier
  2007-06-29 19:33             ` Richard Stallman
  0 siblings, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2007-06-28 18:51 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

>     1 - sometimes a single `setq' is not enough to activate a feature.
> That is true, but I don't see that this means we need a special
> framework for these features.

There's no special framework involved.  Just a convention for how to call
the activation function.

>     2 - I like the idea of being able to list the experimental features.
> I think NEWS is good enough for that.

I agree that it's not absolutely important to be able to get
a mechanically-generated list, but it's a good thing.  And since its only
cost is to use a standard naming convention for the activation function, it
seems very much worth it.

> If a feature is a self-contained major mode, and certainly won't affect
> anyone that doesn't enable that mode, that is automatically safe to try
> installing.  So we can just install it with nothing special.

Sure, there are such cases.  E.g. css-mode.  I'm not interested in those
cases here, since we already know how to handle them.

> But if feature involves adding code in some existing files, files
> which have other purposes and uses, that added code might break
> something.  So we might want to add an explicit conditional around
> each piece of code added in other files, so that we KNOW this feature
> can't break anything if you don't enable it.

Or if css-mode did something potentially undesirable in its major-mode
function, in which case enabling it by default for *.css files may not be
desirable either.

A sample patch is attached, which shows the command I'd like to add, the
change to autoload.el to make it more easily accessible, and an example of
how it might be used with vc-bzr.


        Stefan


Index: lisp/emacs-lisp/autoload.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/autoload.el,v
retrieving revision 1.126
diff -u -r1.126 autoload.el
--- lisp/emacs-lisp/autoload.el	26 Jun 2007 19:53:11 -0000	1.126
+++ lisp/emacs-lisp/autoload.el	28 Jun 2007 18:49:15 -0000
@@ -305,6 +305,12 @@
   (interactive "fGenerate autoloads for file: ")
   (autoload-generate-file-autoloads file (current-buffer)))
 
+(defvar experimental-feature nil
+  "File-local variable indicating that this package is experimental.
+Experimental packages need to be explicitly activated by calling
+activate-experimental-PACKAGE.")
+(put 'experimental-feature 'safe-local-variable 'booleanp)
+
 ;; When called from `generate-file-autoloads' we should ignore
 ;; `generated-autoload-file' altogether.  When called from
 ;; `update-file-autoloads' we don't know `outbuf'.  And when called from
@@ -409,6 +409,8 @@
                   (forward-line 1))))))
 
           (when output-start
+            (let ((experimental (and (local-variable-p 'experimental-feature)
+                                     experimental-feature)))
             (with-current-buffer outbuf
               (save-excursion
                 ;; Insert the section-header line which lists the file name
@@ -417,8 +419,11 @@
                 (autoload-insert-section-header
                  outbuf autoloads-done load-name relfile
                  (nth 5 (file-attributes relfile)))
-                (insert ";;; Generated autoloads from " relfile "\n"))
-              (insert generate-autoload-section-trailer)))
+                  (insert ";;; Generated autoloads from " relfile "\n")
+                  (when experimental
+                    (insert "(defun activate-experimental-" load-name " ()\n")))
+                (when experimental (insert ")\n"))
+                (insert generate-autoload-section-trailer))))
           (message "Generating autoloads for %s...done" file))
         (or visited
             ;; We created this buffer, so we should kill it.
Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.863
diff -u -r1.863 simple.el
--- lisp/simple.el	23 Jun 2007 12:18:52 -0000	1.863
+++ lisp/simple.el	28 Jun 2007 18:49:15 -0000
@@ -5596,6 +5596,30 @@
 	 buffer-invisibility-spec)
     (setq buffer-invisibility-spec nil)))
 \f
+
+(defconst activate-experimental-prefix "activate-experimental-")
+(defun activate-experimental-feature (feature)
+  "Activate the feature FEATURE which is considered experimental."
+  (interactive
+   (let ((features
+          (delete "feature"
+                  (mapcar (lambda (str)
+                            (substring
+                             str (length activate-experimental-prefix)))
+                          (all-completions activate-experimental-prefix
+                                           obarray 'fboundp)))))
+     (if (null features)
+         (error "No experimental features in this release")
+       (list (completing-read "Feature: " features)))))
+  (let ((f (intern-soft (concat activate-experimental-prefix
+                                (if (symbolp feature)
+                                    (symbol-name feature)
+                                  feature)))))
+    ;; If the function is not defined, assume this used to be an
+    ;; experimental feature but has now been blessed as a fully supported
+    ;; feature, so there's nothing left to do to activate it.
+    (when (fboundp f) (funcall f))))
+
 ;; Minibuffer prompt stuff.
 
 ;(defun minibuffer-prompt-modification (start end)
Index: lisp/vc-bzr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-bzr.el,v
retrieving revision 1.7
diff -u -r1.7 vc-bzr.el
--- lisp/vc-bzr.el	28 Jun 2007 02:01:54 -0000	1.7
+++ lisp/vc-bzr.el	28 Jun 2007 18:49:15 -0000
@@ -549,5 +549,10 @@
     (remove-hook 'vc-post-command-functions 'vc-bzr-post-command-function)))
 
 (provide 'vc-bzr)
+
+;; Local Variables:
+;; experimental-feature: t
+;; End:
+
 ;; arch-tag: 8101bad8-4e92-4e7d-85ae-d8e08b4e7c06
 ;;; vc-bzr.el ends here

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: Experimental features
  2007-06-28 18:51           ` Stefan Monnier
@ 2007-06-29 19:33             ` Richard Stallman
  0 siblings, 0 replies; 22+ messages in thread
From: Richard Stallman @ 2007-06-29 19:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

    >     1 - sometimes a single `setq' is not enough to activate a feature.
    > That is true, but I don't see that this means we need a special
    > framework for these features.

    There's no special framework involved.  Just a convention for how to call
    the activation function.

I do not see that we need a special framework for these features
merely because they are "experimental".  It just seems superfluous.

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2007-06-29 19:33 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-22 21:05 Experimental features Stefan Monnier
2007-06-22 21:22 ` Lennart Borgman (gmail)
2007-06-23  4:15   ` Stefan Monnier
2007-06-23 12:40     ` Thien-Thi Nguyen
2007-06-23 19:07       ` Stefan Monnier
2007-06-23  2:51 ` dhruva
2007-06-23  6:00 ` Andreas Röhler
2007-06-24  1:43   ` T. V. Raman
2007-06-24  3:02     ` Eli Zaretskii
2007-06-24  3:59       ` T. V. Raman
2007-06-24 18:42         ` Eli Zaretskii
2007-06-23 13:19 ` Richard Stallman
2007-06-23 13:37   ` Juanma Barranquero
2007-06-24 14:40     ` Richard Stallman
2007-06-24 14:53       ` Juanma Barranquero
2007-06-24 19:25         ` Stefan Monnier
2007-06-23 19:16   ` Stefan Monnier
2007-06-24 14:41     ` Richard Stallman
2007-06-24 19:23       ` Stefan Monnier
2007-06-24 23:47         ` Richard Stallman
2007-06-28 18:51           ` Stefan Monnier
2007-06-29 19:33             ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).