[Plug] Αφισοκόλληση Fosscomm 2010
keramida at ceid.upatras.gr
keramida at ceid.upatras.gr
Tue Apr 6 18:26:57 EEST 2010
On Tue, 6 Apr 2010 17:48:26 +0300, Dimitris Leventeas <mydimle at gmail.com> wrote:
> Χρόνια Πολλά!
>
> Μια παρατήρηση (on topic) και μια ερώτηση (off topic).
>
> Παρατήρηση: Στη σχολή (η/υ) υπάρχουν οι αφισολάτρες και οι αφισομάχοι
> αυτή την περίοδο. Θέλει λίγο προσοχή στα μέρη όπου θα
> αναρτηθούν. Μπορώ να βοηθήσω και εγώ αν γίνει διακριτικά.
Ontws. Gi auto exei nohma na pame mazi me toulaxiston enan akoma apo to
CEID. De leei na pame na kollhsoume kati kai meta na tsantistei o
kosmos toso polu pou na min thelei na erthei p.x. sth FOSSCOMM epeidh
den tous arese o tropos pou kollhsame tis enhmerwtikes afisses.
Molis kseroume poses afises kai pote tha ta poume gia th mera pou tha
tis kollhsoume ;-)
> Ερώτηση @keramida: Τα δυο spaces όταν τελειώνει μια πρόταση έχουν
> μείνει ως συνήθεια από τα comments στον προγραμματισμό ή ο emacs κάνει
> θαύματα πάλι;
Einai hardcoded ston nwtiaio muelo mou. Pataw to SPACE dyo fores xwris
na to skeftomai kan pleon.
Den exw psaksei idiaitera an ginetai automata apo to Emacs, alla nomizw
pws allazontas to binding apo tous xarakthres pou exoun 'syntax code'
typoy 'punctuation' apo #'self-insert-command se kati pio eksypno isws
kai na ginetai entelws automata.
O elegxos an o teleytaios xarakthras pou exei eisax8ei einai xarakthras
me 'punctuation' syntax einai kati san:
(defun punctuation-char-p (char)
(= (char-syntax char) $.)
Antistoixa enas whitespace xarakthras exei syntax code 32 (space):
(defun whitespace-char-p (char)
(= (char-syntax char) ? ))
Gia na eksagoume ena xarakthra apo to buffer se sygkekrimenh 8esh arkei
kati san:
(defun buffer-char-at (point)
(aref (buffer-substring-no-properties point (1+ point)) 0)
Opote 'koitaksei' to Emacs sto teleytaio character pou egine insert
arkei meta kati san:
(buffer-char-at (1- (point)))
Kati san th syn8hkh pou xrhsimopoiei to TeX gia na katalabei an enas
xarakthras me 'punctuation' syntax akoloutheite apo space kai prin apo
auton *den* einai xarakthras me space syntax einai kati san:
(when (let ((position (point)))
(and (whitespace-char-p (buffer-char-at position))
(punctuation-char-p (buffer-char-at (1- position)))
(not (whitespace-char-p (buffer-char-at (- position 2))))))
(insert " "))
Me *ligo* kwdika akoma eimai sigouros oti to Emacs mporei na eisagei
automata double spaces meta apo punctuation characters molis pathseis to
prwto whitespace character meta apo punctuation.
Epeidh uparxei ena 'pattern' ston tropo pou grafetaio elegxos parapanw
isws exei nohma na graftei kai kati san mapping function pou elegxei mia
seira apo N predicates arxizontas apo to position X enos buffer. Tote
to parapanw 'and' tha mporei na antikatasta8ei apo ena pio high-level
elegxo, p.x. apo kati san:
(when (every (buffer-substring-map-syntax (- (point) 2)
(list whitespace-char-p punctuation-char-p
(complement whitespace-char-p))))
(insert " "))
Alla to kourazw hdh ;-)
More information about the Plug
mailing list