summaryrefslogtreecommitdiff
path: root/lisp/userlock.elc
blob: edd87dfcdd10e7b4afa30ddf49c05b4a046c1ecf (plain)
ofshex dumpascii
0000 0a 28 70 75 74 20 28 71 75 6f 74 65 20 66 69 6c 65 2d 6c 6f 63 6b 65 64 29 20 28 71 75 6f 74 65 .(put.(quote.file-locked).(quote
0020 20 65 72 72 6f 72 2d 63 6f 6e 64 69 74 69 6f 6e 73 29 20 28 71 75 6f 74 65 20 28 66 69 6c 65 2d .error-conditions).(quote.(file-
0040 6c 6f 63 6b 65 64 20 66 69 6c 65 2d 65 72 72 6f 72 20 65 72 72 6f 72 29 29 29 0a 0a 28 64 65 66 locked.file-error.error)))..(def
0060 75 6e 20 61 73 6b 2d 75 73 65 72 2d 61 62 6f 75 74 2d 6c 6f 63 6b 20 28 66 6e 20 6f 70 70 6f 6e un.ask-user-about-lock.(fn.oppon
0080 65 6e 74 29 20 22 5c 0a 41 73 6b 20 75 73 65 72 20 77 68 61 74 20 74 6f 20 64 6f 20 77 68 65 6e ent)."\.Ask.user.what.to.do.when
00a0 20 68 65 20 77 61 6e 74 73 20 74 6f 20 65 64 69 74 20 46 49 4c 45 20 62 75 74 20 69 74 20 69 73 .he.wants.to.edit.FILE.but.it.is
00c0 20 6c 6f 63 6b 65 64 20 62 79 20 55 53 45 52 2e 0a 54 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 68 .locked.by.USER..This.function.h
00e0 61 73 20 61 20 63 68 6f 69 63 65 20 6f 66 20 74 68 72 65 65 20 74 68 69 6e 67 73 20 74 6f 20 64 as.a.choice.of.three.things.to.d
0100 6f 3a 0a 20 20 64 6f 20 28 73 69 67 6e 61 6c 20 27 62 75 66 66 65 72 2d 66 69 6c 65 2d 6c 6f 63 o:...do.(signal.'buffer-file-loc
0120 6b 65 64 20 28 6c 69 73 74 20 46 49 4c 45 20 55 53 45 52 29 29 0a 20 20 20 20 74 6f 20 72 65 66 ked.(list.FILE.USER)).....to.ref
0140 72 61 69 6e 20 66 72 6f 6d 20 65 64 69 74 69 6e 67 20 74 68 65 20 66 69 6c 65 0a 20 20 72 65 74 rain.from.editing.the.file...ret
0160 75 72 6e 20 74 20 28 67 72 61 62 20 74 68 65 20 6c 6f 63 6b 20 6f 6e 20 74 68 65 20 66 69 6c 65 urn.t.(grab.the.lock.on.the.file
0180 29 0a 20 20 72 65 74 75 72 6e 20 6e 69 6c 20 28 65 64 69 74 20 74 68 65 20 66 69 6c 65 20 65 76 )...return.nil.(edit.the.file.ev
01a0 65 6e 20 74 68 6f 75 67 68 20 69 74 20 69 73 20 6c 6f 63 6b 65 64 29 2e 0a 59 6f 75 20 63 61 6e en.though.it.is.locked)..You.can
01c0 20 72 65 77 72 69 74 65 20 69 74 20 74 6f 20 75 73 65 20 61 6e 79 20 63 72 69 74 65 72 69 6f 6e .rewrite.it.to.use.any.criterion
01e0 20 79 6f 75 20 6c 69 6b 65 20 74 6f 20 63 68 6f 6f 73 65 20 77 68 69 63 68 20 6f 6e 65 20 74 6f .you.like.to.choose.which.one.to
0200 20 64 6f 2e 22 20 28 62 79 74 65 2d 63 6f 64 65 20 22 ca 20 88 cb 8b 87 22 20 5b 61 6e 73 77 65 .do.".(byte-code."......".[answe
0220 72 20 6f 70 70 6f 6e 65 6e 74 20 66 6e 20 74 65 6d 20 69 6e 68 69 62 69 74 2d 71 75 69 74 20 74 r.opponent.fn.tem.inhibit-quit.t
0240 20 63 75 72 73 6f 72 2d 69 6e 2d 65 63 68 6f 2d 61 72 65 61 20 71 75 69 74 2d 66 6c 61 67 20 6e .cursor-in-echo-area.quit-flag.n
0260 69 6c 20 68 65 6c 70 2d 63 68 61 72 20 64 69 73 63 61 72 64 2d 69 6e 70 75 74 20 28 28 62 79 74 il.help-char.discard-input.((byt
0280 65 2d 63 6f 64 65 20 22 c8 18 08 3f 85 64 00 ca cb 09 0a 23 88 c5 c5 1e 06 1c cc 72 21 c8 89 16 e-code."...?.d.....#.......r!...
02a0 07 88 2a 1b 0b 0e 09 55 83 28 00 cd 20 82 5f 00 ce 0b cf 5c 22 89 10 88 08 3f 83 41 00 d0 20 88 ..*....U.(...._....\"....?.A....
02c0 ca d1 21 88 d2 d3 21 82 5f 00 08 41 d4 3d 83 51 00 cd 20 88 c8 89 10 82 5f 00 08 41 d5 3d 85 5f ..!...!._..A.=.Q........_..A.=._
02e0 00 d6 d7 d8 0a 09 45 5c 22 29 88 82 02 00 88 08 41 29 87 22 20 5b 61 6e 73 77 65 72 20 6f 70 70 ......E\")......A).".[answer.opp
0300 6f 6e 65 6e 74 20 66 6e 20 74 65 6d 20 69 6e 68 69 62 69 74 2d 71 75 69 74 20 74 20 63 75 72 73 onent.fn.tem.inhibit-quit.t.curs
0320 6f 72 2d 69 6e 2d 65 63 68 6f 2d 61 72 65 61 20 71 75 69 74 2d 66 6c 61 67 20 6e 69 6c 20 68 65 or-in-echo-area.quit-flag.nil.he
0340 6c 70 2d 63 68 61 72 20 6d 65 73 73 61 67 65 20 22 25 73 20 69 73 20 6c 6f 63 6b 69 6e 67 20 25 lp-char.message."%s.is.locking.%
0360 73 3a 20 61 63 74 69 6f 6e 20 28 73 2c 20 71 2c 20 70 2c 20 3f 29 3f 20 22 20 64 6f 77 6e 63 61 s:.action.(s,.q,.p,.?)?.".downca
0380 73 65 20 61 73 6b 2d 75 73 65 72 2d 61 62 6f 75 74 2d 6c 6f 63 6b 2d 68 65 6c 70 20 61 73 73 6f se.ask-user-about-lock-help.asso
03a0 63 20 28 28 31 31 35 20 2e 20 74 29 20 28 31 31 33 20 2e 20 79 69 65 6c 64 29 20 28 37 20 2e 20 c.((115...t).(113...yield).(7...
03c0 79 69 65 6c 64 29 20 28 31 31 32 29 20 28 36 33 20 2e 20 68 65 6c 70 29 29 20 62 65 65 70 20 22 yield).(112).(63...help)).beep."
03e0 50 6c 65 61 73 65 20 74 79 70 65 20 71 2c 20 73 2c 20 6f 72 20 70 3b 20 6f 72 20 3f 20 66 6f 72 Please.type.q,.s,.or.p;.or.?.for
0400 20 68 65 6c 70 22 20 73 69 74 2d 66 6f 72 20 33 20 68 65 6c 70 20 79 69 65 6c 64 20 73 69 67 6e .help".sit-for.3.help.yield.sign
0420 61 6c 20 66 69 6c 65 2d 6c 6f 63 6b 65 64 20 22 46 69 6c 65 20 69 73 20 6c 6f 63 6b 65 64 22 5d al.file-locked."File.is.locked"]
0440 20 31 34 29 29 5d 20 32 29 29 0a 0a 28 64 65 66 75 6e 20 61 73 6b 2d 75 73 65 72 2d 61 62 6f 75 .14))].2))..(defun.ask-user-abou
0460 74 2d 6c 6f 63 6b 2d 68 65 6c 70 20 6e 69 6c 20 28 62 79 74 65 2d 63 6f 64 65 20 22 c0 90 c1 c2 t-lock-help.nil.(byte-code."....
0480 21 91 87 22 20 5b 22 2a 48 65 6c 70 2a 22 20 70 72 69 6e 63 20 22 49 74 20 68 61 73 20 62 65 65 !..".["*Help*".princ."It.has.bee
04a0 6e 20 64 65 74 65 63 74 65 64 20 74 68 61 74 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 6d 6f 64 69 n.detected.that.you.want.to.modi
04c0 66 79 20 61 20 66 69 6c 65 20 74 68 61 74 20 73 6f 6d 65 6f 6e 65 20 65 6c 73 65 20 68 61 73 0a fy.a.file.that.someone.else.has.
04e0 61 6c 72 65 61 64 79 20 73 74 61 72 74 65 64 20 6d 6f 64 69 66 79 69 6e 67 20 69 6e 20 45 4d 41 already.started.modifying.in.EMA
0500 43 53 2e 0a 0a 59 6f 75 20 63 61 6e 20 3c 73 3e 74 65 61 6c 20 74 68 65 20 66 69 6c 65 3b 20 54 CS...You.can.<s>teal.the.file;.T
0520 68 65 20 6f 74 68 65 72 20 75 73 65 72 20 62 65 63 6f 6d 65 73 20 74 68 65 0a 20 20 69 6e 74 72 he.other.user.becomes.the...intr
0540 75 64 65 72 20 69 66 20 28 73 29 68 65 20 65 76 65 72 20 75 6e 6d 6f 64 69 66 69 65 73 20 74 68 uder.if.(s)he.ever.unmodifies.th
0560 65 20 66 69 6c 65 20 61 6e 64 20 74 68 65 6e 20 63 68 61 6e 67 65 73 20 69 74 20 61 67 61 69 6e e.file.and.then.changes.it.again
0580 2e 0a 59 6f 75 20 63 61 6e 20 3c 70 3e 72 6f 63 65 65 64 3b 20 79 6f 75 20 65 64 69 74 20 61 74 ..You.can.<p>roceed;.you.edit.at
05a0 20 79 6f 75 72 20 6f 77 6e 20 28 61 6e 64 20 74 68 65 20 6f 74 68 65 72 20 75 73 65 72 27 73 29 .your.own.(and.the.other.user's)
05c0 20 72 69 73 6b 2e 0a 59 6f 75 20 63 61 6e 20 3c 71 3e 75 69 74 3b 20 64 6f 6e 27 74 20 6d 6f 64 .risk..You.can.<q>uit;.don't.mod
05e0 69 66 79 20 74 68 69 73 20 66 69 6c 65 2e 22 5d 20 33 29 29 0a 0a 28 70 75 74 20 28 71 75 6f 74 ify.this.file."].3))..(put.(quot
0600 65 20 66 69 6c 65 2d 73 75 70 65 72 73 65 73 73 69 6f 6e 29 20 28 71 75 6f 74 65 20 65 72 72 6f e.file-supersession).(quote.erro
0620 72 2d 63 6f 6e 64 69 74 69 6f 6e 73 29 20 28 71 75 6f 74 65 20 28 66 69 6c 65 2d 73 75 70 65 72 r-conditions).(quote.(file-super
0640 73 65 73 73 69 6f 6e 20 66 69 6c 65 2d 65 72 72 6f 72 20 65 72 72 6f 72 29 29 29 0a 0a 28 64 65 session.file-error.error)))..(de
0660 66 75 6e 20 61 73 6b 2d 75 73 65 72 2d 61 62 6f 75 74 2d 73 75 70 65 72 73 65 73 73 69 6f 6e 2d fun.ask-user-about-supersession-
0680 74 68 72 65 61 74 20 28 66 6e 29 20 22 5c 0a 41 73 6b 20 61 20 75 73 65 72 20 77 68 6f 20 69 73 threat.(fn)."\.Ask.a.user.who.is
06a0 20 61 62 6f 75 74 20 74 6f 20 6d 6f 64 69 66 79 20 61 6e 20 6f 62 73 6f 6c 65 74 65 20 62 75 66 .about.to.modify.an.obsolete.buf
06c0 66 65 72 20 77 68 61 74 20 74 6f 20 64 6f 2e 0a 54 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 68 61 fer.what.to.do..This.function.ha
06e0 73 20 74 77 6f 20 63 68 6f 69 63 65 73 3a 20 69 74 20 63 61 6e 20 72 65 74 75 72 6e 2c 20 69 6e s.two.choices:.it.can.return,.in
0700 20 77 68 69 63 68 20 63 61 73 65 20 74 68 65 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 0a 6f 66 20 .which.case.the.modification.of.
0720 74 68 65 20 62 75 66 66 65 72 20 77 69 6c 6c 20 70 72 6f 63 65 65 64 2c 20 6f 72 20 69 74 20 63 the.buffer.will.proceed,.or.it.c
0740 61 6e 20 28 73 69 67 6e 61 6c 20 27 66 69 6c 65 2d 73 75 70 65 72 73 65 73 73 69 6f 6e 20 28 66 an.(signal.'file-supersession.(f
0760 69 6c 65 29 29 2c 0a 69 6e 20 77 68 69 63 68 20 63 61 73 65 20 74 68 65 20 70 72 6f 70 6f 73 65 ile)),.in.which.case.the.propose
0780 64 20 62 75 66 66 65 72 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 77 69 6c 6c 20 6e 6f 74 20 62 d.buffer.modification.will.not.b
07a0 65 20 6d 61 64 65 2e 0a 59 6f 75 20 63 61 6e 20 72 65 77 72 69 74 65 20 74 68 69 73 20 74 6f 20 e.made..You.can.rewrite.this.to.
07c0 75 73 65 20 61 6e 79 20 63 72 69 74 65 72 69 6f 6e 20 79 6f 75 20 6c 69 6b 65 20 74 6f 20 63 68 use.any.criterion.you.like.to.ch
07e0 6f 6f 73 65 20 77 68 69 63 68 20 6f 6e 65 20 74 6f 20 64 6f 2e 22 20 28 62 79 74 65 2d 63 6f 64 oose.which.one.to.do.".(byte-cod
0800 65 20 22 c8 20 88 c9 8b 87 22 20 5b 61 6e 73 77 65 72 20 74 65 6d 20 63 75 72 73 6f 72 2d 69 6e e."......".[answer.tem.cursor-in
0820 2d 65 63 68 6f 2d 61 72 65 61 20 74 20 68 65 6c 70 2d 63 68 61 72 20 6e 69 6c 20 66 6e 20 62 75 -echo-area.t.help-char.nil.fn.bu
0840 66 66 65 72 2d 62 61 63 6b 65 64 2d 75 70 20 64 69 73 63 61 72 64 2d 69 6e 70 75 74 20 28 28 62 ffer-backed-up.discard-input.((b
0860 79 74 65 2d 63 6f 64 65 20 22 c5 18 08 3f 85 57 00 c8 c9 21 88 ca c3 1a 72 29 21 19 09 0c 55 83 yte-code."...?.W...!....r)!...U.
0880 1c 00 cb 82 21 00 cc 09 cd 5c 22 41 89 10 88 08 3f 83 36 00 ce 20 88 c8 cf 21 88 d0 d1 21 82 52 ....!....\"A....?.6......!...!.R
08a0 00 08 cb 3d 83 45 00 d2 20 88 c5 89 10 82 52 00 08 d3 3d 85 52 00 d4 d5 d6 0e 06 44 5c 22 29 88 ...=.E........R...=.R......D\").
08c0 82 02 00 88 c8 d7 21 88 c5 89 16 07 29 87 22 20 5b 61 6e 73 77 65 72 20 74 65 6d 20 63 75 72 73 ......!.....).".[answer.tem.curs
08e0 6f 72 2d 69 6e 2d 65 63 68 6f 2d 61 72 65 61 20 74 20 68 65 6c 70 2d 63 68 61 72 20 6e 69 6c 20 or-in-echo-area.t.help-char.nil.
0900 66 6e 20 62 75 66 66 65 72 2d 62 61 63 6b 65 64 2d 75 70 20 6d 65 73 73 61 67 65 20 22 46 69 6c fn.buffer-backed-up.message."Fil
0920 65 20 68 61 73 20 63 68 61 6e 67 65 64 20 6f 6e 20 64 69 73 6b 3b 20 72 65 61 6c 6c 79 20 77 61 e.has.changed.on.disk;.really.wa
0940 6e 74 20 74 6f 20 65 64 69 74 20 74 68 65 20 62 75 66 66 65 72 3f 20 28 79 2c 20 6e 20 6f 72 20 nt.to.edit.the.buffer?.(y,.n.or.
0960 43 2d 68 29 20 22 20 64 6f 77 6e 63 61 73 65 20 68 65 6c 70 20 61 73 73 6f 63 20 28 28 31 31 30 C-h).".downcase.help.assoc.((110
0980 20 2e 20 79 69 65 6c 64 29 20 28 37 20 2e 20 79 69 65 6c 64 29 20 28 31 32 31 20 2e 20 70 72 6f ...yield).(7...yield).(121...pro
09a0 63 65 65 64 29 20 28 36 33 20 2e 20 68 65 6c 70 29 29 20 62 65 65 70 20 22 50 6c 65 61 73 65 20 ceed).(63...help)).beep."Please.
09c0 74 79 70 65 20 79 20 6f 72 20 6e 3b 20 6f 72 20 3f 20 66 6f 72 20 68 65 6c 70 22 20 73 69 74 2d type.y.or.n;.or.?.for.help".sit-
09e0 66 6f 72 20 33 20 61 73 6b 2d 75 73 65 72 2d 61 62 6f 75 74 2d 73 75 70 65 72 73 65 73 73 69 6f for.3.ask-user-about-supersessio
0a00 6e 2d 68 65 6c 70 20 79 69 65 6c 64 20 73 69 67 6e 61 6c 20 66 69 6c 65 2d 73 75 70 65 72 73 65 n-help.yield.signal.file-superse
0a20 73 73 69 6f 6e 20 22 46 69 6c 65 20 63 68 61 6e 67 65 64 20 6f 6e 20 64 69 73 6b 22 20 22 46 69 ssion."File.changed.on.disk"."Fi
0a40 6c 65 20 6f 6e 20 64 69 73 6b 20 6e 6f 77 20 77 69 6c 6c 20 62 65 63 6f 6d 65 20 61 20 62 61 63 le.on.disk.now.will.become.a.bac
0a60 6b 75 70 20 66 69 6c 65 20 69 66 20 79 6f 75 20 73 61 76 65 20 74 68 65 73 65 20 63 68 61 6e 67 kup.file.if.you.save.these.chang
0a80 65 73 2e 22 5d 20 31 32 29 29 5d 20 32 29 29 0a 0a 28 64 65 66 75 6e 20 61 73 6b 2d 75 73 65 72 es."].12))].2))..(defun.ask-user
0aa0 2d 61 62 6f 75 74 2d 73 75 70 65 72 73 65 73 73 69 6f 6e 2d 68 65 6c 70 20 6e 69 6c 20 28 62 79 -about-supersession-help.nil.(by
0ac0 74 65 2d 63 6f 64 65 20 22 c0 90 c1 c2 21 91 87 22 20 5b 22 2a 48 65 6c 70 2a 22 20 70 72 69 6e te-code."....!..".["*Help*".prin
0ae0 63 20 22 59 6f 75 20 77 61 6e 74 20 74 6f 20 6d 6f 64 69 66 79 20 61 20 62 75 66 66 65 72 20 77 c."You.want.to.modify.a.buffer.w
0b00 68 6f 73 65 20 64 69 73 6b 20 66 69 6c 65 20 68 61 73 20 63 68 61 6e 67 65 64 0a 73 69 6e 63 65 hose.disk.file.has.changed.since
0b20 20 79 6f 75 20 6c 61 73 74 20 72 65 61 64 20 69 74 20 69 6e 20 6f 72 20 73 61 76 65 64 20 69 74 .you.last.read.it.in.or.saved.it
0b40 20 77 69 74 68 20 74 68 69 73 20 62 75 66 66 65 72 2e 0a 0a 49 66 20 79 6f 75 20 73 61 79 20 60 .with.this.buffer...If.you.say.`
0b60 79 27 20 74 6f 20 67 6f 20 61 68 65 61 64 20 61 6e 64 20 6d 6f 64 69 66 79 20 74 68 69 73 20 62 y'.to.go.ahead.and.modify.this.b
0b80 75 66 66 65 72 2c 0a 79 6f 75 20 72 69 73 6b 20 72 75 69 6e 69 6e 67 20 74 68 65 20 77 6f 72 6b uffer,.you.risk.ruining.the.work
0ba0 20 6f 66 20 77 68 6f 65 76 65 72 20 72 65 77 72 6f 74 65 20 74 68 65 20 66 69 6c 65 2e 0a 49 66 .of.whoever.rewrote.the.file..If
0bc0 20 79 6f 75 20 73 61 79 20 60 6e 27 2c 20 74 68 65 20 63 68 61 6e 67 65 20 79 6f 75 20 73 74 61 .you.say.`n',.the.change.you.sta
0be0 72 74 65 64 20 74 6f 20 6d 61 6b 65 20 77 69 6c 6c 20 62 65 20 61 62 6f 72 74 65 64 2e 0a 0a 59 rted.to.make.will.be.aborted...Y
0c00 6f 75 20 6d 69 67 68 74 20 63 6f 6e 73 69 64 65 72 20 61 6e 73 77 65 72 69 6e 67 20 60 6e 27 2c ou.might.consider.answering.`n',
0c20 20 72 75 6e 6e 69 6e 67 20 60 4d 2d 78 20 72 65 76 65 72 74 2d 62 75 66 66 65 72 27 20 74 6f 0a .running.`M-x.revert-buffer'.to.
0c40 62 72 69 6e 67 20 74 68 65 20 74 65 78 74 20 69 6e 20 45 6d 61 63 73 20 69 6e 74 6f 20 61 63 63 bring.the.text.in.Emacs.into.acc
0c60 6f 72 64 20 77 69 74 68 20 77 68 61 74 20 69 73 20 6f 6e 20 64 69 73 6b 2c 20 61 6e 64 20 74 68 ord.with.what.is.on.disk,.and.th
0c80 65 6e 0a 6d 61 6b 69 6e 67 20 74 68 65 20 63 68 61 6e 67 65 20 61 67 61 69 6e 2e 22 5d 20 33 29 en.making.the.change.again."].3)
0ca0 29 0a ).