Profile

Cover photo
Prakash Kailasa
92 followers|38,757 views
AboutPostsPhotosVideos

Stream

Prakash Kailasa

Shared publicly  - 
1
Add a comment...
 
Is there an emacs command to list all environment variables? I could not find any, and came up with this short snippet:

(defun listenv ()
  "List all environment variables in order."
  (interactive)
  (switch-to-buffer-other-window "*env*")
  (erase-buffer)
  (insert (mapconcat 'identity process-environment "\n"))
  (sort-lines nil (point-min) (point-max)))
3
1
Christoph David Hermann's profile photo
 
Maybe the variable  initial-environment is what you are looking for. 
Add a comment...

Prakash Kailasa

Discussion  - 
 
Perl frameworks are missing from this list. I am not sure if plans are afoot in the Catalyst, Dancer, Mojolicious and other framework communities, but it would be nice to if they submitted versions of the benchmarks to this.
4
Aaron Swenson's profile photo
 
I can't believe they didn't consider Perl at all!
Add a comment...

Prakash Kailasa

Shared publicly  - 
 
 
Really good visualization of perceived vs actual wealth inequality in the U.S.
1
Add a comment...

Prakash Kailasa

Shared publicly  - 
1
barefootmeg's profile photo
 
I totally agree about non-tested subjects getting kicked to the side. We've seen that happen in our kids schools. 

The one thing the writer didn't mention was the added stress on these tests that is passed on to the students. When I took standardized tests in school it was no big deal. We got scored, but it didn't mean much other than to provide a sense of where I was at academically. But now so much rides on these tests (mostly teachers' careers and whether or not a school will remain open or be revamped some how) that the pressure is pushed all the way down from the district to the kids. We get phone calls home a week in advance reminding us that testing is coming up. There are rewards for attendance which lead the kids to go in even when they're sick. My kids, for several years in a row, used to get stomach aches and head aches the weekend before testing. In their minds, all of their future rests upon these stupid tests. Somehow, that's what's being drilled into them at school. 
Add a comment...

Prakash Kailasa

Shared publicly  - 
 
This is awesome. Crossword puzzle + Regular expressions!
 
A puzzle from the MIT Mystery Hunt, for all you regular expression fans. PDF at http://www.coinheist.com/rubik/a_regular_crossword/grid.pdf
1
Add a comment...
Have them in circles
92 people
Rogério Toth's profile photo
Kanpur Info's profile photo
Ramesh Cherivirala's profile photo
OUThai Narey's profile photo
Rob Kinyon's profile photo
Juan Medina's profile photo
Qi Zhou's profile photo
Naresh Pala's profile photo
Madhavi Kailasa's profile photo

Prakash Kailasa

Shared publicly  - 
 
Found this snake in our driveway this morning. Not sure if it's poisonous.
1
Jeff Bisbee's profile photo
 
Red touching black, venom lack :)
Add a comment...
 
I am experiencing something weird.

I have a prog-mode for a homegrown DSL. The mode was written using generic-x and mmm-mode. It is autoloaded for files with certain extensions.

I have recently noticed that after a source file with one of the known extensions is visited, I sometimes get the message "Symbol's function definition is void: vector" (most recently, I was executing a vc-annotate command when this happened).

I checked for the function definition of vector before and after visiting the source file. The function definition existed before visiting, but after visiting, it disappeared.

I inserted (message "...") lines at appropriate places in the code for this prog-mode, but those messages indicated that the during the execution of the prog-mode code, everything was fine.

So, something else is happening after the prog-mode is completely loaded, but I don't know what it is. So, my question to all you emacs-gurus is: how do I find out what is causing this?
1
Prakash Kailasa's profile photoDmitry Gutov's profile photo
4 comments
 
+Prakash Kailasa You've installed something very broken, either that pacakge, or maybe some additional elisp code that your distribution has put into the global site-lisp dir.

That "snapshot" is very old anyway. The current snapshot version is 24.3.50.3.
Add a comment...

Prakash Kailasa

Customization  - 
 
When I am editing code, often I copy current line, comment it and paste it below before beginning to edit the cloned code. So,  after doing a lot of times this I wrote up this little function. I have used emacs for a long time, but my elisp-fu is still next to nothing, so it took me a while to get things right. Especially since I wanted it to work for either active region or current line.

    (defun copy-comment-paste ()
      "copy active region/current line, comment, and then paste"
      (interactive)
      (unless (use-region-p)
        (progn
          (beginning-of-line 2)
          (push-mark (line-beginning-position 0))))
      (kill-ring-save (region-beginning) (region-end))
      (comment-region (region-beginning) (region-end))
      (yank)
      (exchange-point-and-mark)
      (indent-according-to-mode))

Here's the gist for the same: https://gist.github.com/prakashk/5319782

Please suggest any improvements.
7
Mark Hepburn's profile photoGavin Panella's profile photobin chen's profile photoNoah Friedman's profile photo
19 comments
 
+Gavin Panella No, in fact save-excursion is the right thing to use.  I was debugging something earlier and forgot to put it back.  Thanks for the reminder :-)

Here's the latest version, which I think has somewhat more helpful behavior in a couple of corner cases.

(defun copy-and-comment-lines (beg end)
  "Insert a copy of the lines in region and comment them.
When transient-mark-mode is enabled, if no region is active then only the
current line is acted upon.

If the region begins or ends in the middle of a line, that entire line is
copied, even if the region is narrowed to the middle of a line.
The copied lines are commented according to mode.

Current position is preserved."
  (interactive "r")
  (save-excursion
    (save-restriction
      (widen)
      (when (and transient-mark-mode (not (use-region-p)))
        (setq beg (line-beginning-position)
              end (line-beginning-position 2)))

      (goto-char beg)
      (setq beg (line-beginning-position))
      (goto-char end)
      (unless (= (point) (line-beginning-position))
        (setq end (line-beginning-position 2)))

      (goto-char beg)
      (insert-before-markers (buffer-substring-no-properties beg end))
      (comment-region beg end))

    ;; Don't modify region or display if called as a function.
    (when (called-interactively-p 'all)
      ;; If narrowed, make sure newly commented lines are visible in the
      ;; narrowed region.
      (when (> (point-min) beg)
        (narrow-to-region beg (point-max)))

      ;; Make sure newly commented lines are visible in the window if at the
      ;; very top.
      (unless (pos-visible-in-window-p beg)
        (set-window-start (selected-window) beg)))))
Add a comment...

Prakash Kailasa

Shared publicly  - 
 
I have been watching  #Jeopardy for nearly 20 years. Last night's episode (second day of the Teen Tournament finals) is by far the best one I have seen in all these years.

Way to go Leonard Cooper!
1
Add a comment...

Prakash Kailasa

Shared publicly  - 
1
Add a comment...

Prakash Kailasa

Shared publicly  - 
 
Persistent little guy!!
1
1
Add a comment...
People
Have them in circles
92 people
Rogério Toth's profile photo
Kanpur Info's profile photo
Ramesh Cherivirala's profile photo
OUThai Narey's profile photo
Rob Kinyon's profile photo
Juan Medina's profile photo
Qi Zhou's profile photo
Naresh Pala's profile photo
Madhavi Kailasa's profile photo
Links