jed-users mailing list

[2002 Date Index] [2002 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

patch for recent.sl v2.0.1 from JMR


Here is a little patch for recent.sl v2.0.1 (from JMR) which enable local 
recent files.

The original recent.sl just uses one global file. I wanted to have different 
sessions depending on the directory in which I start jed. The solution was
pretty simple: Load .jedrecent from local directory if it exists or use the 
global one if not. While editing you can enable local recent file by calling
function "enable_local_session" - then the recent data is written to the
local file on exit. 

And there should be a hint to add the require("recent") _to the end_ of 
.jedrc _after_ userdefined setup like mode hooks etc.

Bye,
Andree

--- /home/andree/recent.sl-2.0.1	Fri Nov  8 14:56:54 2002
+++ /usr/share/jed/lib/recent.sl	Fri Nov  8 18:12:40 2002
@@ -36,6 +36,9 @@
 custom_variable("RECENT_FILES_LIST", ".jedrecent");
 #endif
 
+% do you want a local recent list? (stored in directory where jed was started)
+custom_variable("Local_Recent_List", 0);
+
 % The size of the Recent_Files array (won't change after loading recent.sl)
 custom_variable("MAX_RECENT_FILES", 15);
 
@@ -73,6 +76,8 @@
 static variable Recent_Files =
   create_circ(RecentMark_Type, MAX_RECENT_FILES, "linear");
 
+static variable Local_Recent_File;
+
 % --- Functions ----------------------------------------------------
 
 %Test static define show_recent() {show(Recent_Files);}
@@ -101,7 +106,12 @@
    if (dir == "" and getenv("TEMP") != NULL)
 	dir = getenv("TEMP");
 #endif
-   return dircat (dir, file);
+   file = dircat(dir,file);
+% override if local session wanted:
+   if ((Local_Recent_List == 1) or (file_status(Local_Recent_File) == 1))
+      file = Local_Recent_File;
+   message(file);
+   return file;
 }
 
 % load the n-th-last file from the Recent_Files list and goto right position
@@ -264,8 +274,15 @@
 				   &recent_files_menu_callback);
 }
 
+public define enable_local_session ()
+{
+  Local_Recent_List = 1;
+}
+
 % --- Code that gets executed when recent.sl is called -----------------
 
+% get local session file:
+Local_Recent_File = dircat(getcwd(),RECENT_FILES_LIST);
 % Initialize the Recent_Files 
 load_recent_files_file();
 

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2002 date index] [2002 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]