all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "paul r" <paul.r.ml@gmail.com>
To: rms@gnu.org
Cc: pmr@pajato.com, cyd@stupidchicken.com, emacs-devel@gnu.org
Subject: Re: Neat features in Eclipse editor
Date: Tue, 25 Mar 2008 11:08:34 +0100	[thread overview]
Message-ID: <e30f0f320803250308v30844f9bi249513830fd3cc56@mail.gmail.com> (raw)
In-Reply-To: <E1JdyJC-000615-6g@fencepost.gnu.org>

2008/3/25, Richard Stallman <rms@gnu.org>:
> When you switch from workspace A to workspace B, does your current
>  window configuration get recorded as workspace A?

Yes, it does.

>  The configurations should have names, not single letters.

I firstly had an implementation using names. Then I changed it for
single letters, because it saves a lot of time when switching. But
this can be changed back easily.

> This predefined "gud" perspective should have a window
>  for displaying source, and windows for displaying other things.
>  Each window should have tabs for switching between the various
>  things you can view in that window.

I often use mode hooks to call `workspace-goto-or-create' before, so
that mode-specific automatic windows reorganisation happen in a
dedicated workspace. I then use C-c C-d space to swap workspaces. As
an example, calendar/diary is hooked so that I'm taken to workspace
'c' before windows reorganisation happens.

Concerning the tabs, I'm not sure to see what they are. But if I
understand correctly, my opinion is that buffer switching is superior
and less intrusive. But, clearly, buffer switching prompt should be
dependant of current worspace/window/subframe etc. so that the choice
proposed, the order of buffer, the completion mechanism etc make you
reach what you are after quickly, and avoid unrelated buffers prompt
pollution.

>
>  Your code might be the start of this feature, but a convenient
>  smooth perspectives feature would do a lot more than this.

No doubt. A friend of mine knows eclipse, I'll ask for a demo.

I noticed some typo in the previous past of the workspaces code, sorry
about that, below is the exact same code with typo corrected.

-- Paul

;; DEFINITION
;;-----------
;;
;; Multi-workspaces
;; Author : Paul Rivier <paul dot r dot ml at gmail dot com>
;;
;; Load this file, then use C-c C-d [any character] to switch
;; to workspace specified
;; Special keys are :
;;  - TAB to show workspaces list			
;;  - space to swap with last workspace			
;;  - DEL to kill current workspace			
;;  - RET to restore current workspace to its saved state


;;;;;;;;;;;;;;;;;;
;; DEPENDENCIES ;;
;;;;;;;;;;;;;;;;;;
(eval-when-compile (require 'cl))

;;;;;;;;;;;;;;;
;; VARIABLES ;;
;;;;;;;;;;;;;;;

(defvar current-workspace nil "Workspace you are currently in")
(defvar default-workspace ?1
  "This workspace will be created at init time. You can not delete
this workspace. When killing a workspace, you fallback to
default-workspace.")
(defvar workspaces-list nil "List of open workspaces")

;;;;;;;;;;;;;;;;;;;;;
;; GLOBAL BINDINGS ;;
;;;;;;;;;;;;;;;;;;;;;

(global-set-key "\C-c\C-d" 'workspace-goto)

;;;;;;;;;;;;;;;
;; FUNCTIONS ;;
;;;;;;;;;;;;;;;
(lexical-let ((last-workspace default-workspace))
  ;; above : vars -- below : functions
  (labels ((workspaces-list-sort
	    ()
	    ;; 	    "Sort list workspaces-list, save and return it."
	    (setq workspaces-list
		  (sort workspaces-list
			(lambda (a b)
			  (< (car a) (car b))))))
	
	   (workspaces-list-add
	    (wsid)
	    ;; 	    "Add current configuration to workspaces list under wsid."
	    (setq workspaces-list
		  (cons
		   (cons wsid (current-window-configuration))
		   workspaces-list))
	    (workspaces-list-sort))
	
	   (workspace-save-current
	    ()
	    ;; 	    "Save current workspace."
	    (workspace-delete current-workspace)
	    (workspaces-list-add current-workspace))
	
	   (workspace-delete
	    (wsid)
	    ;; 	    "Delete workspace wsid."
	    (setq workspaces-list
		  (assq-delete-all wsid workspaces-list)))
	
	   (workspaces-id-list
	    ()
	    ;; 	    "Return a list of workspaces ids."
	    (mapcar #'car workspaces-list))
	
	   (workspace-create-new
	    (wsid)
	    ;; 	    "Create a new workspace with id wsid."
	    (workspace-goto ?0)
	    (workspaces-list-add wsid)
	    (workspace-goto wsid))
	
	   (workspace-kill-current
	    ()
	    ;;          "kill the workspace you are currently in"
	    (if (not (or (eq current-workspace default-workspace)
			 (eq current-workspace ?0)))
		(let ((cws current-workspace)
		      (lws last-workspace))
		  (workspace-goto default-workspace)
		  (workspace-delete cws)
		  (setq last-workspace default-workspace)
		  (concat "\nWorkspace "
			  (char-to-string cws) " killed"))
	      (concat "\nSpecial workspaces "
		      (char-to-string current-workspace)
		      " can not be killed")))
	
	   (workspace-exists-p
	    (wsid)
	    ;; 	    "Return t if workspace wsid exists."
	    (when (assoc wsid workspaces-list) t)))

    ;; externaly bound functions

    (defun workspaces-init ()
      "Initialize workspaces-list and others"
      (setq workspaces-list nil)
      (workspaces-list-add ?0)
      (setq current-workspace ?0)
      (workspace-goto-or-create default-workspace))

    (defun workspace-goto-or-create (wsid)
      "If workspace wsid exists, goto it, else create it."
      (if (workspace-exists-p wsid)
	  (workspace-goto wsid)
	(workspace-create-new wsid)))

    (defun workspace-goto (wsid)
      "Go to another workspace, wsid is workspace identifier. wsid
can be any character, except those mentioned below. Workspace 0
is a template workspace, do not use it unless you know what you
do. Special characters are :
 - TAB to show workspaces list			
 - space to swap with last workspace			
 - DEL to kill current workspace			
 - RET to restore current workspace to its saved state"
      (interactive "cTo which workspace do you want to go ? ")
      (let ((wscfgcons (assoc wsid workspaces-list))
	    (special ""))
	(if wscfgcons
	    (progn
	      (unless (eq wsid current-workspace)
		  (workspace-save-current))
	      (set-window-configuration (cdr wscfgcons))
	      (unless (or (eq current-workspace ?0)
			  (eq wsid current-workspace))
		(setq last-workspace current-workspace))
	      (setq current-workspace wsid)
	      (when (eq wsid ?0)
		(setq special
		      "\n!-!-! This is template workspace. New workspaces are based on it.")))
	  ;; Workspace does not exist, it might be a special key
	  (cond
	   ((eq wsid 9) ; 9 is TAB
	    ())
	   ((eq wsid 13) ; 13 is RET
	    (workspace-goto current-workspace)
	    (workspace-save-current))
	   ((eq wsid 32) ; 32 is space
	    (workspace-goto last-workspace))
	   ((eq wsid 127) ; 127 is DEL (backspace)
	    (setq special (workspace-kill-current)))
	   ;; it is not a special key, create workspace
	   (t
	    (when (y-or-n-p
		   "This workspace does not exist, should it be created ? ")
	      (workspace-create-new wsid)))))
	(message (concat "Now on workspace " (char-to-string current-workspace)
			 "\nWorkspaces list is : "
			 (mapconcat 'char-to-string
				    (remq ?0 (workspaces-id-list)) "  ")
			 special))))
    ))

;;;;;;;;;;;
;; HOOKS ;;
;;;;;;;;;;;
;; base workspaces 0 and default are created at startup only

(unless workspaces-list (workspaces-init))




  parent reply	other threads:[~2008-03-25 10:08 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-22 21:45 Neat features in Eclipse editor Richard Stallman
2008-03-22 21:56 ` Chong Yidong
2008-03-22 21:36   ` Tom Tromey
2008-03-22 23:09   ` Leo
2008-03-23 14:18     ` William Xu
2008-03-23  2:27   ` Juri Linkov
2008-03-23  9:53     ` joakim
2008-03-23 10:50       ` martin rudalics
2008-03-23 10:54       ` martin rudalics
2008-03-23 19:35         ` John S. Yates, Jr.
2008-03-23 19:39           ` Thomas Lord
2008-03-23 21:06             ` John S. Yates, Jr.
2008-03-23 21:42               ` Thomas Lord
2008-03-23 19:49           ` Drew Adams
2008-03-25  8:11           ` dtm
2008-03-24  0:53       ` Stefan Monnier
2008-03-24  0:54       ` Richard Stallman
2008-03-24 19:02         ` joakim
2008-03-25  1:06           ` Bastien
2008-03-25 18:31             ` Richard Stallman
2008-03-25 19:19               ` Rajappa Iyer
2008-03-26  1:33                 ` Stefan Monnier
2008-03-26  4:46                 ` Richard Stallman
2008-03-25  1:50           ` Richard Stallman
2008-04-18 13:25             ` joakim
2008-04-19  2:23               ` Richard Stallman
2008-03-24  0:53   ` Richard Stallman
2008-03-24 18:47     ` paul r
2008-03-25  1:50       ` Richard Stallman
2008-03-25  3:53         ` Window configuration UI (was: Neat features in Eclipse editor) Stefan Monnier
2008-03-25 10:54           ` Window configuration UI Lennart Borgman (gmail)
2008-03-25 18:13             ` Stefan Monnier
2008-03-26  4:47           ` Window configuration UI (was: Neat features in Eclipse editor) Richard Stallman
2008-03-26  9:41             ` Window configuration UI Lennart Borgman (gmail)
2008-03-26 22:26               ` Richard Stallman
2008-03-27  2:14                 ` Stefan Monnier
2008-03-27 19:41                   ` Richard Stallman
2008-03-29 16:27                   ` Michael Sperber
2008-03-31  2:41           ` Window configuration UI (was: Neat features in Eclipse editor) Nick Roberts
2008-03-31 16:25             ` Richard Stallman
2008-04-01  3:00               ` Window configuration UI Stefan Monnier
2008-04-01 21:04                 ` Richard Stallman
2008-03-25 10:08         ` paul r [this message]
2008-03-25 10:55           ` Neat features in Eclipse editor David Reitter
2008-03-25 11:35             ` paul r
2008-03-25 21:00               ` Richard Stallman
2008-03-25 22:10                 ` paul r
2008-03-26  1:50                   ` Robert J. Chassell
2008-03-26 22:26                   ` Richard Stallman
2008-03-25 21:01           ` Richard Stallman
2008-03-25 21:16             ` Lennart Borgman (gmail)
2008-03-25 23:17               ` Mike Mattie
2008-03-26  2:23               ` Evans Winner
2008-03-26  7:09               ` Jan Djärv
2008-03-26  7:18                 ` Drew Adams
2008-03-26 22:25               ` Richard Stallman
2008-03-26 22:38                 ` Sebastian Rose
2008-03-26 22:57                   ` paul r
2008-03-26 23:20                     ` Sebastian Rose
2008-03-27  6:57                       ` David Kastrup
2008-03-27  0:22                     ` Mike Mattie
2008-03-27  0:17                   ` Mike Mattie
2008-03-27 19:41                   ` Richard Stallman
2008-03-27 20:18                     ` Sebastian Rose
2008-03-27  0:18                 ` Lennart Borgman (gmail)
2008-03-25  0:48   ` Bastien
2008-03-24  1:51 ` Dan Nicolaescu
2008-03-24 12:29   ` Richard Stallman
2008-03-24 18:24     ` joakim
2008-03-25  1:50       ` Richard Stallman
2008-04-06 20:52 ` Tab bar (was: Neat features in Eclipse editor) Juri Linkov
2008-04-06 23:07   ` Tab bar David Koppelman
2008-04-06 23:48     ` Juri Linkov
2008-04-07  0:05       ` David Koppelman
2008-04-07  0:32         ` Juri Linkov
2008-04-07 14:59           ` Richard Stallman
2008-04-07 23:27             ` Juri Linkov
2008-04-08 15:35               ` Richard Stallman
2008-04-08 15:50                 ` Jason Rumney
2008-04-08 16:58                   ` Drew Adams
2008-04-09 10:33                   ` Richard Stallman
2008-04-09 23:27                     ` Juri Linkov
2008-04-07 14:59       ` Richard Stallman
2008-04-07 15:33         ` Lennart Borgman (gmail)
2008-04-07 23:31           ` Juri Linkov
2008-04-08  0:21             ` Drew Adams
2008-04-08  2:06             ` Stefan Monnier
2008-04-08 22:11               ` Juri Linkov
2008-04-09  2:00                 ` Stefan Monnier
2008-04-09  8:45                   ` Juri Linkov
2008-04-09  9:34                     ` Paul R
2008-04-09 14:12                       ` Stefan Monnier
2008-04-08 13:58           ` Andrew W. Nosenko
2008-04-08 14:21             ` Lennart Borgman (gmail)
2008-04-08 15:55               ` Paul R
2008-04-08 16:04                 ` Dan Nicolaescu
2008-04-08 16:24                   ` Paul R
2008-04-08 16:25                   ` Andrew W. Nosenko
2008-04-08 20:10                     ` Lennart Borgman (gmail)
2008-04-08 21:16                       ` David De La Harpe Golden
2008-04-08 21:47                         ` Lennart Borgman (gmail)
2008-04-09  2:50                           ` David De La Harpe Golden
2008-04-09  8:50                             ` Juri Linkov
2008-04-09  7:55                           ` Jason Rumney
2008-04-09 10:34                           ` Richard Stallman
2008-04-09 14:59                             ` Lennart Borgman (gmail)
2008-04-08 22:09                         ` Juri Linkov
2008-04-09  8:12                           ` Andreas Schwab
2008-04-09  8:52                             ` Juri Linkov
2008-04-08 16:50                 ` Ehud Karni
2008-04-07 16:09         ` Drew Adams
2008-04-07 16:52           ` Stefan Monnier
2008-04-07 23:35             ` Juri Linkov
2008-04-08 15:36             ` Richard Stallman
2008-04-09  1:56               ` Stefan Monnier
2008-04-09 10:34                 ` Richard Stallman
2008-04-07 23:28         ` Juri Linkov
2008-04-07  1:37   ` Tab bar (was: Neat features in Eclipse editor) Drew Adams
2008-04-07 14:59     ` Richard Stallman
2008-04-07 16:09       ` Drew Adams
2008-04-07 23:35         ` Mathias Dahl
2008-04-07 23:33     ` Tab bar Juri Linkov
2008-04-07 15:00   ` Tab bar (was: Neat features in Eclipse editor) Richard Stallman
2008-04-07 23:59   ` Tab bar David De La Harpe Golden
2008-04-08 22:06     ` Juri Linkov
2008-04-09  1:07       ` David De La Harpe Golden
2008-04-09  8:48         ` Juri Linkov
2008-04-09  9:24           ` David Kastrup
2008-04-09 23:28             ` Juri Linkov
2008-04-10  6:11               ` Jan Djärv
2008-04-10  7:31                 ` Jason Rumney
2008-04-10  7:44                   ` Jason Rumney
2008-04-10  8:08                   ` Jan Djärv
2008-04-10 15:31                 ` Richard Stallman
2008-04-10 23:11                   ` Juri Linkov
2008-04-12  0:10                     ` Richard Stallman
2008-04-09  9:45           ` Paul R
2008-04-09 23:29             ` Juri Linkov
2008-04-10  8:09               ` Paul R
  -- strict thread matches above, loose matches on Subject: below --
2008-03-28  1:49 Neat features in Eclipse editor Josh Gilbert
2008-03-28 23:54 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e30f0f320803250308v30844f9bi249513830fd3cc56@mail.gmail.com \
    --to=paul.r.ml@gmail.com \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=pmr@pajato.com \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.