!* -*- TECO -*- ! !* [toed.xkl.com]DXX:CLOCK.EMACS.1, 10-Apr-96 17:10:31, Edit by ALDERSON! !* Reconstructed from sourceless library. Commented as well as possible ! !~Filename~:! !Time macros for EMACS! CLOCK !& Setup CLOCK Library:! !S Setup for showing time in mode line. Runs Q$CLOCK Setup Hook$ if there one. Updates display every minute, but you can change this by doing MM & Start Realtime Modeline Clock.! 0FO..QCLOCK_Setup_Hook[1 FQ1"GM1' "#M.M&_Set_My_Mode_LinefsModeMacro m(m.m&_Start_Realtime_Modeline_Clock)'  !& Get Current Time:! !S Returns Time as a string of exactly 7 chars.! [0[1[2[3[4 fs date :fs fd convert u1 !* Convert current date to string! 12,14:g1u2 !* Get minutes portion! 9,11:g1u3 !* Get hours portion! F=200"e !* On the hour? (Minutes = 00?)! F=300"e:i*Midnite' !* Yes, special hour 00 or 12?! F=312"e:i*Noon___'' 3/12"e !* Two-digit hour?! :i4am' !* Assume forenoon...! "#(3-12):\u3 !* Convert from 24hr to 12hr clock! fq3-1"e:i3_3' !* If only 1 hour digit, pad leading space! :i4pm' !* Afternoon...! F=3_0"e:i312' !* If before 1am or 1pm, say 12! "#F=300"e:i312'' 0:g3-48"e !* If the leading character still = 0! 0:F3_' !* make it a space! :i*3:24 !* and return our string.! !& Start Realtime Modeline Clock:! !S Get the realtime clock interrupts going. Optional numeric argument specifies seconds between update. Default is 60.! F F -1"n (30 * 60) FS Clk Int' "# 30 * (F) FS Clk Int' 0 M.V Modeline_Full_Update_Time M.M &_Insert_Correct_Time_in_Mode_Line fs CLK Macro 0 !& Insert Correct Time In Mode Line:! !S Updates modeline display of time.! 1,M.M&_Periodic_Action"n !* Perform any defined periodic action! M(M.M&_Periodic_Action)' qModeline_Full_Update_Time"e !* Toggle! 1uModeline_Full_Update_Time 0' "# 0uModeline_Full_Update_Time' f[ ins len qEditor_Name[0 f~..J 0  -1 -FQ0 "N oSet' FQ..J - (FQ0+8) "l oSet' :i0 ..J M(M.M&_Get_Current_Time)[1 FQEditor_Name +1 :F01 F=0 ..J "e 0' q0u..J FR 0 !Set! m(fs mode macro)fr 0 !& Set My Mode Line:! !S Set the ..J Mode to display options and current time. When setting the major mode, call this with a nonzero argument and the major mode name as a string argument. It will change the mode and run the Mode Hook variable, if there is one.! -(FS QP PTR * 2) FS MODE CH !* Arrange to call FS Mode Macro$ if! !* control returns to outer stack! QEditor_Name[0 !* Save editor name and current mode name! QMode[1 "N :I1  Q1UMode !* Get new major mode name, if any! 0FO..Q1_Mode_Hook[2 !* Look up mode hook! Q2"NM2'' !* If there is one, run it! 0[.1 q..J[.2 F~.2 0 -1 -FQ0 "N 0' F[BBind G0 I_ g(m(m.m&_get_current_time)*)I_ 0FO..QEditor_Type[2 Q2"N G2 I_' I( G1 QSubmodeU2 FQ2"G I[2]' QAuto_Fill_Mode"N I_Fill' QAuto_Save_Mode"N I_Save' "# QAuto_Save_Default"N I_Save(off)'' FS^RREPLACE"NI_Ovwrt' FSTYISINK"NI_Def' MSet_Mode_Line_Hook + 0 U2 FQ2"G G2' I)__ QBuffer_NameU2 QBuffer_FilenamesU1 Q1"N Q1 F[ D FILE F~ (FS D FN1 :F6) 2"E 0 U2'' Q2"N I2:__' FQ1"G G1 FS OS TECO"N !* If not on ITS! FQ1 R FS HS NAME :F6 U2 FS OS TECO -1"E !* If *really* TENEX! FQ2 F~2"E FQ 2D'' "# 4 F~ DSK:"E 4D !* If Tops-20! FQ2 + 2 F~ <2>"E FQ2 + 2 D''' ZJ FS D VERS"E -2D'' I_ QInhibit_Write"L I(RO)_'' ZJ Q.1< I]_ > J Q.1,[I HX..J 0