Profile

Cover photo
1,621 followers|1,174,364 views
AboutPostsPhotosVideos

Stream

 
LispyScript. A #javascript With Lispy Syntax And Macros! http://lispyscript.com/ #lisp
7
1
Dan Lentz's profile photoAlexander Skobelev's profile photo
 
I've used "parenscript" in the past. I believe it is much more mature. Plan to use clojurescript in the future -- it is actually a full blown Clojure compiler to JavaScript.
Add a comment...

ErgoEmacs

Shared publicly  - 
 
 
why you shouldn't use dotimes and cons. Guy Steele on Parallel Programing: Get rid of cons! http://xahlee.info/comp/Guy_Steele_parallel_computing.html #lisp
6
2
Alexey Cherkaev's profile photoAnler Hp's profile photo
Add a comment...

ErgoEmacs

Discussion  - 
 
#emacs 
Here's some very useful commands i now and then hear people surprised by. 
apologies if i posted this before. 

• list-matching-lines (this is a alias to occur)
• delete-matching-lines (this is a alias to flush-lines)
• delete-non-matching-lines (this is a alias to keep-lines)
• delete-duplicate-lines (Emacs 24.4) delete duplicated lines in text selection.

• sort-lines
• sort-numeric-fields
• reverse-region

• highlight-lines-matching-regexp

List/Delete/Highlight Matching Lines, Sort/Reverse Lines 
http://ergoemacs.org/emacs/elisp_list_matching_lines.html
4
Add a comment...

ErgoEmacs

Tutorials  - 
 
#emacs #lisp  
Here's a emacs lisp command that deletes the current file.

(defun xah-delete-current-file (&optional φno-backup-p)
  "Delete the file associated with the current buffer.

Also close the current buffer.  If no file is associated, just close buffer.

A backup file is created with filename appended “~‹date time stamp›~”. Existing file of the same name is overwritten. If the file is not associated with buffer, the backup file name starts with “xx_”.

When called with `universal-argument', don't create backup."
  (interactive "P")
  (let* (
         (fName (buffer-file-name))
         (bufferIsFile-p (if (null fName) nil t ))
         (backupName (concat fName "~" (format-time-string "%Y%m%d_%H%M%S") "~")))
    (if bufferIsFile-p
        (progn
          (save-buffer fName)
          (if φno-backup-p
              nil
            (copy-file fName backupName t))
          (delete-file fName)
          (message "deleted and backup created at 「%s」." backupName))
      (progn
        (if φno-backup-p
            nil
          (write-region (point-min) (point-max) (concat "xx_~" (format-time-string "%Y%m%d_%H%M%S") "~")))))
    (kill-buffer (current-buffer))))

perm url
 http://ergoemacs.org/emacs/elisp_delete-current-file.html
2
Yuriy Pitometsu's profile photoErgoEmacs's profile photo
6 comments
 
+ErgoEmacs you right, thanks for correction.
Add a comment...

ErgoEmacs

Shared publicly  - 
 
the JavaScript dom event has a event.metaKey!
https://developer.mozilla.org/en-US/docs/Web/API/event.metaKey

this is back in 1997ish, when Sun Microsystems is still around with Sun Station and Sun Microsystems Type 6 Keyboard
http://xahlee.info/kbd/sun_microsystems_keyboard.html
is stil around.

it has a diamond ◆ key, and that key is officially called Meta.

linux developed to name that key Super instead.
2
1
Xah Lee's profile photoMoe Bius's profile photoErgoEmacs's profile photo
2 comments
 
+Moe Bius the Cmd key on Apple keyboard and Window key on Microsoft keyboard both send the same scancode, at least on the usb ones. I think probably so for the Meta ◆ key on Sun type 6 too.

linux just call the Window key as Super.

The Meta, Super, Hyper, are dedicated hardware keys on the lisp machine keyboards.
http://xahlee.info/kbd/lisp_keyboards.html
Add a comment...

ErgoEmacs

Questions  - 
 
in magit-mode, magit-status, pressing tab on a file will show diff. Is there a way to collapse it again (or collapse all) without having to move cursor on the file?

#emacs
 
1
Jan Synáček's profile photoAlexander Yakushev's profile photoErgoEmacs's profile photoTom Willemse's profile photo
6 comments
 
You can also press ^ followed by TAB. It doesn't directly answer your question, but I think that making a function that calls the two (their functions respectively) and binding it should do the job.
Add a comment...
Have them in circles
1,621 people
David Capello's profile photo
Ceng Satoshi's profile photo
Liam O'Rourke's profile photo
蒋维's profile photo
Kai Zhang's profile photo

ErgoEmacs

Shared publicly  - 
 
there's a ergoemacs keybinding for the editor Light Table. See: https://github.com/nikitakit/LightTable-ErgoEmacs
3
Add a comment...

ErgoEmacs

Shared publicly  - 
 
emacs lisp: twitterfy-shorten text

(defun xah-twitterfy ()
  "shorten words for twitter."
  (interactive)
  (let* ((bds (get-selection-or-unit 'block))
         (p1 (elt bds 1))
         (p2 (elt bds 2)))
    (replace-pairs-region p1 p2 '(
                                  [" are " " r "]
                                  [" you " " u "]
                                  [" and " " & "]
                                  [", " ","]
                                  ["..." "…"]
                                  [". " "。"]
                                  ["。 " "。"]
                                  ))))

Xah Emacs Blog
http://ergoemacs.org/emacs/blog.html
1
Dan Lentz's profile photoErgoEmacs's profile photo
23 comments
 
Ive considered picking up a license for M.  I may.  The issue is that I have a lot of Clojure work on my plate and my first priority is getting good at that.  Actually, the language I'm second most interested in is Swift so I could write iPad apps (since I already have some familiarity with Scala)  But I will do as I can to work on this macro issue with you until you see the light. :)

BTW, I think it would be more practical for you to learn Clojure, and its macro system is almost identical to CL, just a bit simplified.
Add a comment...

ErgoEmacs

Discussion  - 
 
emacs: How to filter elements from a list?
emacs lisp doesn't have a filter/grep function for list.
you can use the cl-remove-if or cl-remove-if-not in CL library, like this:

(require 'cl)
(cl-remove-if-not 'numberp  '(1 "a" 2)) ;; (1 2)

(emacs 24.x changed the name remove-if to cl-remove-if)

or, you can write your own:

(defun xah-filter-list (φpredicate φlist)
  "Return a new list such that φpredicate is true on all members of φlist.
This function is similar to perl's “grep” or other lang's “filter” function."
  (let ((ξresult '()))
    (mapc
     (lambda (ξx)
       (when (funcall φpredicate ξx) (setq ξresult (cons ξx ξresult))))
     φlist)
    (reverse ξresult)))

Emacs Lisp: Filter a List
http://ergoemacs.org/emacs/elisp_filter_list.html
2
Randy Morris's profile photoAlex Bennée's profile photoErgoEmacs's profile photoArtur Malabarba's profile photo
12 comments
 
+Randy Morris it's of reasonable importance, but the benefit is reasonable as well. So I'll have to weigh my chances. :-)
Either way, thanks for pointing it out.
Add a comment...

ErgoEmacs

Packages  - 
 
ergoemacs-mode is now in GNU ELPA http://elpa.gnu.org/packages/ergoemacs-mode.html
5
1
Fabrizio Guzzetta's profile photo
Add a comment...

ErgoEmacs

Shared publicly  - 
 
 
DAS came out with a new keyboard. DAS Keyboard 4 Professional
http://www.amazon.com/dp/B00JG01QTY/?tag=xahh-20

pity, it's the same old PC form keyboard, ones that whack your hand.

hacker news discussion https://news.ycombinator.com/item?id=7979073 

see also Computer Keyboards, Layouts, Hotkeys, Macros, RSI ⌨
http://xahlee.info/kbd/keyboarding.html
1
ErgoEmacs's profile photoDave Pawson's profile photo
3 comments
 
The seller (on amazon UK). I bought direct from their website, not through amazon, though likely it would be the same. Return costs born by purchaser. 
Add a comment...

ErgoEmacs

Shared publicly  - 
 
 
someone must have posted about my Truly Ergonomic Keyboard page somewhere, because, am getting several emails about the keyboard.

i don't know where yet, probably one of those reddit/geekhack/deskthority. gonna find out.
3
1
Steffen Glückselig's profile photo
Add a comment...
People
Have them in circles
1,621 people
David Capello's profile photo
Ceng Satoshi's profile photo
Liam O'Rourke's profile photo
蒋维's profile photo
Kai Zhang's profile photo
Contact Information
Contact info
Email
Story
Tagline
Emacs tips & tricks + ErgoEmacs news.
Introduction
One or two emacs tips per day.

• Tips in using emacs
• Tips in coding emacs lisp.
• Occasional news/tips about ErgoEmacs.

Spread emacs. Join us.