Surrounding a region with Emacs lisp.


09:23:22 # Life Surrounding a region with Emacs lisp. I wanted to surround a region with HTML tags and here's what I learnt today. Specifying "r" in interactive gives two numbers, begin and end. When I want to obtain multiple kinds of values in interactive, I can use newlines to delimit. set-marker is an api to keep a marker at relative position even after edits, API needs making make-marker to create an empty marker first, and seems like the number of markers affects editing speed so the API is made to allow reuse of markers. After I got these going I could now write.

(defun dancer-region-tag (begin end tag) "Surround region with TAG" (interactive "r\nsTag:") (goto-char end) (insert tag) (let* ((real-end (set-marker (make-marker) (point)))) (goto-char begin) (insert tag) (goto-char real-end))) 

10:42:10 # Life Setting wake-on-lan in Debian way. There's several ways that your network interfaces can be configured. The Debian way is to use ifup/ifdown. Make sure your network is configured with it by checking ifquery. nmcli d and networkctl list are NM and systemd equivalents of commands. After you know which one is managing your device you can go ahead and set up WoL configuration appropriately. Default Debian installation would probably start with a ifup/ifdown config.

 $ nmcli d
DEVICE TYPE STATE CONNECTION eno1 ethernet unmanaged -- lo loopback unmanaged -- $ sudo ifquery -l --allow=hotplug
eno1
$ sudo ifquery -l
lo $ sudo networkctl list
WARNING: systemd-networkd is not running, output will be incomplete. IDX LINK TYPE OPERATIONAL SETUP 1 lo loopback n/a unmanaged 2 eno1 ether n/a unmanaged 2 links listed. 

If your network configuration is managed with ifup, then refer to /usr/share/doc/ethtool/README.Debian for configuration. ethernet-wol g line allows enabling waking from magic packet. My configuration added a line and looks like this now:

 . . .
# The primary network interface
allow-hotplug eno1
iface eno1 inet dhcp
# This is an autoconfigured IPv6 interface
iface eno1 inet6 auto ethernet-wol g