<![CDATA[ Emacs & Emacsist BY Hick]]><![CDATA[ Circe 2.3 released]]>We just released version 2.3 of Circe, a Client for IRC in Emacs.

The package is available from github, MELPA stable and MELPA unstable. The latter will track further development changes, so use at your own risk.


  • Circe (Lui) now has a track bar. Use (enable-lui-track-bar) to get a bar where you stopped reading when you did hide a buffer.

  • Buffers are now by default limited to 100k, as large buffers cause unreasonable slowdown in Emacs.

  • Autopaste now defaults to ix.io and also knows about ptpb.pw.

  • A number of faces have been updated to be nicer to the eye.

  • Improve compatibility with the Slack IRC gateway.

  • Lots of bug fixes.

Thanks to defanor, Janis Dzerins and Vasilij Schneidermann for their contributions.

原文链接 http://blog.jorgenschaefer.de/2016/05/circe-23-released.html]]>
<![CDATA[ 2016-05-30 Emacs News]]>
  • Configuration and workflow:

  • Coding:

  • Other:

  • New packages:

  • Links from reddit.com/r/emacs, /r/orgmode, Hacker News, planet.emacsen.org,Youtube, the changes to the Emacs NEWS file, and emacs-devel.

    原文链接 http://sachachua.com/blog/2016/05/2016-05-30-emacs-news/]]>
    <![CDATA[ Emacs Hack Night]]>The other night at the PDX Emacs Meeting, the assembled hackers expressed an interest in getting together to actually hack on Emacs projects. While our previous ? dozen meetings featured interesting demonstrations and workshops, I’ve always envisioned our meetup as a place to go to where we could alter our Dear Editor.

    I’ve never done this sort of thing before, and am not sure how to proceed. Consider the following initial ideas as the start of a discussion where I can gather feedback, and then build some sort of play book prior to our evening’s fun.

    Who should attend this hack night?

    • Are you new to Emacs, and would like to know more?

    • Do you know Emacs well, and would like to help others?

    • Do you use Emacs, and have an idea to would make it better?

    If you can answer yes to any of those questions, then our Hack Night is for you. The following is my list of what it may take to have a successful Hack Night Project:

    Ideas and Brainstorming

    What if each project/goal consisted of:

    • Something small that could be accomplished in an hour

    • Could be done by 2 or 3 people

    • At least touches Emacs, if not written in it

    If your project idea is large or complicated, carve a small piece, for we need to feel accomplished at the end of the evening.

    I challenged everyone at our meetup to come up with a project, and if every other person came up with an idea, then we could pair up with someone.

    Environment Setup

    What shall we do to prepare for the Hack Night? Since no two people have even remotely similar Emacs setup, I would suggest using Floobits, as an easy plugin for Emacs that allows two or more people to edit the same project, but within their own Emacs environment.

    Along with installing the plugin, create a Floobits account, and create a project. Seems that it works well if you have a Github account, but that is not necessary.

    Are you new to Emacs?Great! Perhaps before you come, you might want prepare a bit by getting familiar with the editor. I’d suggest:

    • Tutorial… start Emacs, and type Control-h and then type t, or check out an online tutorial.

    • Emacs Lisp Introduction… in Emacs, type Control-h and then i, and move the cursor to Emacs Lisp Intro, or read it online.

    • Emacs Lisp Hacking Tips… this YouTube video by John Wiegley shows a bit of editing and debugging Lisp in Emacs. Lot of nifty tips.

    Also, check out Sacha Chua’s Read Lisp, Tweak Emacs essays.

    Project Setup

    I think well defined goals would make a project easier for others to understand and help. Perhaps:

    • Create a Git repository

    • Push that repository to Github

    • Write a README and describe your ideas

    • Try to break the project into discrete tasks

    Not every project would be ready for immediate coding. Perhaps your project is more an initial brainstorm. I think that would be good too, but make sure you mention that, for some people may want to jump in and start coding, while others, would prefer to help flesh our your skeletal vision.


    I suppose it goes without saying that the lowest bar for the evening will be professionalism. Our group has already established a code of conduct, and I want to make sure that everyone feels safe and welcome and is able to enjoy each others’ company.

    The Soap Box

    Finally, it is time to talk others into joining your project. Wouldn’t it be great if we sent our ideas to the group before the evening started, so we could just jump in with both feet… or, since we’re Emacs Hackers, all eight tentacles.

    Would it be too much to ask:

    • Project description

    • Level of domain knowledge

    • Level of Emacs and Lisp knowledge

    • Expectation of participation

    • End goal and accomplishment

    I’ll begin with a project that I’ve been stewing about for a while. The complete project would be too much for a single evening, but step one may be in order. Let me describe it, and you can tell me if it would work.

    An Example

    I often use Chef in my day job for deploying and configuring my applications, and often kick off a shell command to move a recipe to a Chef server using the knife command line program. I’ve often wish for some knife-related Emacs functions to stream-line my workflow, so…

    Project Description

    I would like to build the emacs-knife project that interfaces with the Chef web service API. I think we could use the emacs-request library.

    Domain Knowledge

    Understanding Chef and its API is, in a way, immaterial. We are using a web service, so understand HTTP Get and Post requests would be more important.

    Lisp Knowledge

    This would be written in Emacs Lisp using either the emacs-request library, or the default URL package. This shouldn’t be tricky Lisp, but knowing (or wanting to know) Lisp may be in order.

    Expectation of Participants

    I would like to get 2 to 4 other people sitting across from each other, connected over Floobits, and hacking on this project.

    I will set up a Chef server, and will be able to connect to it through standard Curl calls before the Hack Night. I will also try to have a list of tasks, but that is more for organization, and I would like each person to follow along with the code (as that way, people less familiar with Lisp will be able to learn).

    End Goal

    If we could read the settings from a knife.rb configuration file, and upload a Chef cookbook, we would have ourselves the start of a great project. Other Chef commands would layer on top of the ideas in this initialknife-cookbook-upload function, and if we have time, we could discuss interfaces, e.g. Magit-style popups, etc.

    Preliminary Results

    I decided to try this approach on a more limited scale with a friend of mine, Ken Maupin. Before we met, I did the following:

    • Created a Github repository

    • Connected the project to my Floobits account

    • Invited Ken’s Floobits account to join as a writer

    • Wrote a few functions and used a few helpful libraries

    • Communicated a rough sketch of the problems to solve

    We learned a wee bit.

    • While I felt I had communicated the goals and problems … I should have written them down.

    • A check list of tasks and metrics would have been ideal

    • Floobits is pretty good but not flawless … save and commit often.1

    • Be willing to jettison initial ideas.

    • I got pretty excited in solving the problems at hand that I left Ken behind. Don’t do this … keep your partners in sync with you.

    In summary, when planning a Hack Night / Office Hours meetup consider the following:

    • Initial preparation pays well … pre-experimentation lends clarity on possible paths and direction

    • Emphasize communal coding and relationships over code accomplishments

    • Set smaller attainable goals … with the night’s encouragement, the hacking will continue.

    Any other suggestions and ideas?



    At times, we noticed file conflicts (as seen in the following screen-shot). If you see them, be careful how you react, as you could undo your partner’s changes (remember, change happens).


    原文链接 http://www.howardism.org/Technical/Emacs/hack-night.html]]>
    <![CDATA[ "One XNOOP in 100 loops will make Emacs terminate"]]>/* On some systems, an X bug causes Emacs to get no more events
    when the window is destroyed. Detect that. (1994.) */
    if (! event_found)
    /* Emacs and the X Server eats up CPU time if XNoOp is done every time.
    One XNOOP in 100 loops will make Emacs terminate.
    B. Bretthauer, 1994 */
    if (x_noop_count >= 100)

    if (next_noop_dpyinfo == 0)
    next_noop_dpyinfo = x_display_list;

    XNoOp (next_noop_dpyinfo->display);

    /* Each time we get here, cycle through the displays now open. */
    next_noop_dpyinfo = next_noop_dpyinfo->next;

    I had some difficulties believing that an over 20 years old comment still holds true, so I snipped this functionality out for fun:

    --- a/xterm.c       2016-06-05 11:38:14.471347194 +0200
    +++ b/xterm.c 2016-06-05 11:36:37.398817889 +0200
    @@ -8786,26 +8786,10 @@ XTread_socket (struct terminal *terminal
    #endif /* USE_GTK */

    - /* On some systems, an X bug causes Emacs to get no more events
    - when the window is destroyed. Detect that. (1994.) */
    if (! event_found)
    - /* Emacs and the X Server eats up CPU time if XNoOp is done every time.
    - One XNOOP in 100 loops will make Emacs terminate.
    - B. Bretthauer, 1994 */
    - if (x_noop_count >= 100)
    - {
    - x_noop_count=0;
    - if (next_noop_dpyinfo == 0)
    - next_noop_dpyinfo = x_display_list;
    - XNoOp (next_noop_dpyinfo->display);
    - /* Each time we get here, cycle through the displays now open. */
    - next_noop_dpyinfo = next_noop_dpyinfo->next;
    - }
    + fprintf(stderr, "XNoOp %d occurred\n", x_noop_count);

    /* If the focus was just given to an auto-raising frame,

    No difference when used on a GTK or Lucid build. Other than nearly every event causing the diagnostic message to print…

    原文链接 http://emacshorrors.com/posts/one-xnoop-in-loops-will-make-emacs-terminate.html]]>
    <![CDATA[ Fill and unfill paragraphs with a single key]]>[fill-paragraph](http://doc.endlessparentheses.com/Fun/fill-paragraph) is probably among the most underappreciated Emacs commands. I use it dozens of times a day, and never stop to think of just how awesome and practical it is. Still, we can make it a little bit better. Every once in a while I need to “unfill” (or “unwrap”) a paragraph that’s broken over many lines.

    By being clever enough, we can make this into a free feature. There’s never any reason to hit M-q twice on the same paragraph, so we can use that as our keybind for the “unfill” command.

    (defun endless/fill-or-unfill ()
    "Like `fill-paragraph', but unfill if used twice."
    (let ((fill-column
    (if (eq last-command 'endless/fill-or-unfill)
    (progn (setq this-command nil)
    (call-interactively #'fill-paragraph)))

    (global-set-key [remap fill-paragraph]

    With this, M-q will act as a toggle. Hitting it once will do its usual thing (even if the paragraph is already filled), but hitting it twice will completely unwrap the current paragraph into a single line.

    原文链接 http://endlessparentheses.com/fill-and-unfill-paragraphs-with-a-single-key.html?source=rss]]>
    <![CDATA[ Show Magit Status window in fullscreen]]>When I moved back to my own Emacs configuration from Spacemacs one thing that I missed most was to have Magit’s status window cover the whole frame.

    Luckily this feature is easy to reproduce with a simple entry in[display-buffer-alist](http://www.lunaryorn.com/2015/04/29/the-power-of-display-buffer-alist.html):

    (add-to-list 'display-buffer-alist
    `(,(rx "*magit: ")
    (reusable-frames . nil)))

    Unfortunately there’s no built-in display function to show a window covering the whole frame but it’s easy enough to write one:

    (defun lunaryorn-display-buffer-fullframe (buffer alist)
    "Display BUFFER in fullscreen.

    ALIST is a `display-buffer' ALIST.

    Return the new window for BUFFER."
    (let ((window (display-buffer-pop-up-window buffer alist)))
    (when window
    (delete-other-windows window))

    We simply need to get hold of any arbitrary window for the buffer, and then just delete all other windows, leaving only the window for our buffer.

    That’s it. Enjoy and share :)

    原文链接 http://www.lunaryorn.com/2016/04/28/fullscreen-magit-status.html]]>
    <![CDATA[ How to auto export html when saving in org-mode?]]>Hick 叽喳:

         原是个 reddit 上的问题, 下面给出的事答案.

    I added the following to my .emacs

    ;; Auto-export org files to html when saved
    (defun org-mode-export-hook ()
    (when (equal major-mode 'org-mode)
    (add-hook 'after-save-hook 'org-html-export-to-html h h)

    However, when I open org file, make some changes, and save, the corresponding html file does not get updated. What's wrong here?

    Edit. The problem was my org version. This works as intended:

    ;; Auto-export org files to html when saved 
    (defun org-mode-export-hook()
    "Auto export html"
    (when (eq major-mode 'org-mode)
    (org-export-as-html t)))

    (add-hook 'after-save-hook 'org-mode-export-hook)


    (defun toggle-org-html-export-on-save ()
    (if (memq 'org-html-export-to-html after-save-hook)
    (remove-hook 'after-save-hook 'org-html-export-to-html t)
    (message "Disabled org html export on save for current buffer..."))
    (add-hook 'after-save-hook 'org-html-export-to-html nil t)
    (message "Enabled org html export on save for current buffer...")))

    You can run this on your org buffers to toggle export-on-save for the buffer.

    原文链接 http://www.reddit.com/r/emacs/comments/4golh1/how_to_auto_export_html_when_saving_in_orgmode/]]>
    <![CDATA[ Emacspeak, an audible interface for Linux]]>Emacspeak, an audible interface for Linux

    Image by :


    Tweet WidgetFacebook LikeReddit logoLinkedin Share ButtonGoogle Plus One

    Screen readers such as Orca work by describing the graphical environment to the user. They deconstruct an arbitrary visual environment that's built on top of an inherently text-based system. On some systems, this is necessary because there's no access—at least pragmatically—to the OS by any other means than the graphical interface. As most Linux users know, however, a graphical interface on a good Unix system is entirely optional in the first place, so there's no need to generate one, deconstruct it, and describe it; the computer can just spit out text.

    I am aware of two efforts forging this path: Emacspeak and ADRIANE (on Knoppix). In this article, we'll take an in-depth look at the former.

    Emacspeak is an audible interface that allows non-sighted users to interact independently and efficiently with a computer, entirely by way of text input and output. Emacspeak uses "audio formatting" and W3C's Aural CSS to produce a full audio representation of input and output.

    Another advantage of using the Emacspeak system is that it inherits Emacs' extensive set of useful packages. As any serious Emacs user knows, it's quite possible to sit in front of a computer, launch Emacs, and never leave it 'til shutdown. Emacs has an application for nearly anything you want to do at a computer on a daily basis, including browsing the Web with w3m, sending and receiving email with rmail, chatting via IRC with erc or circe, listening to audiobooks and music with emms, managing files with dired, running a Unix shell with shell-mode, installing more Emacs packages with a built-in package manager, and scripting pretty much anything and building your own custom modules with elisp.

    And yes, it can also edit text.

    There's a learning curve, of course, but learning any new desktop (and in this model, Emacs is the desktop) entails learning some new concepts and developing new muscle-memory. But if you do give it a chance as an operating environment, Emacs proves itself quickly as a robust and practical user interface.

    Installing the OS

    Since Emacs works on practically everything, there are—at least technically—a dozen different ways to install, configure, and use Emacspeak. There are many posts online about it, but each covers a different configuration and yet none of them appear to do so to completion. This, however, is a definitive round-trip tutorial. It aims to be indifferent to distribution, although some of the fancy startup processes could be implemented one way or another depending on whether you use Systemd startup scripts, OpenRC, or BSD-style scripts. Conceptually, the ideas will be the same no matter what; the important bits are how different components fit together.

    This guide configures a computer such that emacspeak will be the only screen reader on the system and will require only software-based components (it will use the computer speakers to speak the text, and will not require any external "speech synthesizer" or braille output device).

    Please note that these install instructions have been written and performed by a sighted user. It is not optimized for non-sighted users and might require sighted assistance to install. Everyday use from that point requires nothing but a but a blind user (or a sighted user with a blindfold) and the computer.

    Install Linux

    The first step is to install the Linux distribution of choice. I prefer Slackware for its stability, its lack of auto-updates that could potentially break the mission-critical environment of Emacspeak, and the inclusion of the Emacspeak package on its install DVD and package servers. Emacspeak can, however, be installed on any Linux distribution.

    Install Emacspeak

    After installing Linux, log in and install the emacspeakpackage and, if available, the emacspeak-sspackage. Different distributions package it differently, but it's usually safe to just install everything related to emacspeak.

    To confirm that emacspeak is installed, launch it from a terminal by typing:


    You'll probably get errors in response (unless your distribution has configured it for you), but as long as you get a response from the command other thancommand not found, then you'll know that emacspeak is installed and ready to be configured.

    Time to grab a speech synthesizer.

    Configuring speech synthesis

    There's a lot of confusion online about what speech synthesizers are. The first misunderstanding tends to be music-related (speech synthesizers and vocoders are not the same thing). Then there's the old speech recognition confusion (we don't want to talk to our computer, we want our computer to talk to us). And then there are even questions about software speech synthesizers and hardware speech synthesizers. The system we are building uses a software speech synthesizer that will cost $0.

    If the term "speech synthesizer" is confusing to you, just think of it as your screen reader's voice. But in technical terms, it is a software-based speech synthesizer. Think Stephen Hawking.

    The speech synthesizer most actively maintained is Flite, and it works well with Emacs. It's not the prettiest sounding speech a computer's ever rendered, and it does tend to be quite fast, but it's the open source option we have. Companies designing closed source synthesizers could do the world a big favor by open sourcing their synthesizers (or at the very least making them free to use non-commercially). Next time you speak with your government representative, you might even go so far as to ask why none of the tax dollars you spend on purchasing speech synthesis for blind employees also goes toward developing an open source, communal solution. (Although the same could be asked of the OS it's running on in the first place.)

    Install flitefrom your distribution's software repository, or, if you're on Slackware, from SlackBuilds.org.

    Link the sound server and Emacspeak

    The next step is to configure something called a "sound server," which is basically the intermediary link between emacspeakand the software synthesizer flite.

    Without a sound server, Emacs will sit in one corner and Flite in the other, with no way for them to ever communicate with one another, much less read text back to you.

    The sound server we can use is eflite. Install it from your distribution's repository, or on Slackware from SlackBuilds.org.

    Once eflite has been built and installed, you should be able to test flitewith a command like this:

    $ flite -t foobar

    You should hear a voice say "foobar"

    If this test does not work, the most likely problem is that the sound on your computer isn't working or is turned all the way down. Configure sound, play some tests in a multimedia application like VLC just to confirm that your sound is working, and then try the eflitetest again.

    Now you have installed the emacspeak audio desktop, the flite speech synthesizer, and the eflite speech server. The next step is to configure it all to work together.

    Wiring it all together

    Emacspeak discovers what sound server to use from environment variables.

    These don't set themselves, so you need to set them. Before setting them permanently, do a test. At a BASH prompt, set the appropriate environment variable to point to eflite:

    $ DTK_PROGRAM=`which eflite`

    Make it permanent for this session: $ export DTK_PROGRAM

    And launch:

    $ emacspeak

    When Emacs launches, you should hear Emacs being narrated to you.

    If this is not working for you but all the tests up to this point have been successful, then emacspeak is probably not using the correct sound server. After all, if the individual components have proven themselves to work, then the problem can't be individual parts.

    Things to review and troubleshoot:

    It's important that the DTK_PROGRAM environment variable is set so that Emacspeak knows which sound server to send information to. To set this variable properly, you must, within the same BASH shell as the shell you use to launchemacspeak, do exactly the steps above (set the variable, export the variable, launch). If you use a shell other than BASH, then the process may be different (depending on the shell).

    If you change shells or close that shell between setting DTK_PROGRAM and launching Emacspeak, you lose the variable setting and you are launching Emacspeak without it knowing what sound server to use. You can test to see that this variable is set by running echo $DTK_PROGRAM just before launching Emacspeak. If it returns /usr/bin/eflite (or something like that), then the variable is set correctly. If it does not return a path to eflite, double-check that eflite installed correctly and then locate the path to the executable (it should be located somewhere in a bin directory).

    Assuming you get it to work as expected, it's time to make setting the DTK_PROGRAM variable and launching Emacspeak more transparent. To do this, add the commands you ran to test Emacspeak to the user's .bash_profile:

    echo "DTK_PROGRAM=`which eflite`" >> $HOME/.bash_profile echo "export DTK_PROGRAM" >> $HOME/.bash_profile

    Optionally, if this really is the only way you'll ever use Emacs, then you might want to create an alias so that all calls to emacs actually open up emacspeak:

    echo 'alias emacs="emacspeak"' >> $HOME/.bash_profile

    Log out and log back in and type echo $DTK_PROGRAM. If it returns/usr/bin/eflite (or whatever the path to eflite is on your system), then the.bash_profile is working. Launch Emacspeak by typing in emacs, and emacs with Emacspeak functionality should launch and you should hear it narrate to you as expected.

    Now go learn emacs and all of its extensions. Emacs has everything from shells to media players available for it, and all of it will be narrated by Emacspeak. So as long as you never leave emacs (and with so many extensions, you'll find that there may well never be a need to do so), then your computing environment will be spoken aloud to you. A good resource for learning about GNU Emacs is theemacswiki.org, and a very good introductory mini-series in podcast form can be found at Hacker Public Radio; listen to part 1, part 2, and part 3. For bonus points, listen to them using emms!

    Refining the system for non-visual use

    If the Emacspeak system you are setting up is for a blind user, there are two useful modifications to the system that can be made to help usability. As it is now, when the system boots, it runs through the usual launch sequence and then sits silently at a login prompt waiting for the user to enter their login information. Potentially, there's no need to launch a GUI at all; on Slackware, this is the default behavior, and on Systemd startup it can become the default:

    $ sudo systemctl set-default multi-user.target

    Alternately, you can allow a graphical boot but configure, within the desktop environment, to have Emacspeak launch automatically immediately after login. How each desktop manages that is unique to the desktop (generally it's an option in System Settingsor in a dedicated control panel like Startup Applications), or you can add the command to .xinitrc.

    If you're booting to no GUI, then you should provide notification for your user that the boot sequence has ended and a login prompt is waiting for input.

    To create an audible login prompt, we modify a startup script such that some audio command is initiated at the end of the boot sequence. This means that there will be an audible prompt, and then the boot sequence will officially end, and then the login prompt will appear. Traditionally, the init sequence consists of a series of shell scripts that are kept in etc, with the final shell script executed beingrc.local. That's still the case with Slackware and some other systems, and on Systemd compatibility with rc.local is usually built-in.

    Therefore, a command added to rc.local will always execute at the end of the boot sequence. Any audible cue should work; you could play a sound file withogg123 or sox, or just a phrase with flite:

    # echo 'exec /usr/bin/flite -t "please log in."' >> /etc/rc.d/rc.local

    After a successful login, the user is dumped to a non-audible bash prompt. That's a problem, especially since the same happens after a failed login. The easiest solution is to launch Emacspeak automatically after a successful login, simultaneously confirming success and eliminating the redundancy of manually launching Emacspeak every time the user logs into the system.

    To implement this:

    $ echo 'exec /usr/bin/emacspeak' >> $HOME/.bash_profile

    With this in place, Emacspeak is automatically spawned any time the user opens a new shell, serving as the de facto shell environment as well as the de facto desktop.

    How to help

    I hope this guide has helped. Feel free to ask questions via the contact info you find on either slackermedia.ml or here on Opensource.com.

    If you want to help blind Linux usage advance, then there are a few things you can do! Broadly, you can always help by implementing shell scripts and shell-based or elisp-based applications that respect the standard input and output expectations that Unix has established since its very beginnings. It's not just "graybeard" pride that encourages the classic Unix model, it's the preservation of data that can be parsed by both humans and machines in a predictable and usable manner. If you're writing a GUI application, consider breaking its code into shell usage as well as GUI usage; sometimes it takes a little more thought, but generally it results in cleaner code, improved usage of system resources, and better logic.

    If you're a web developer, always check your websites in a text browser like w3m-emacs, lynx, or elinks. It's not just a fun "retro" gimmick; these browsers are how computers (and speech synthesizers like flite) "see" your sites. If you find your site difficult to use in a text interface, so do blind users!

    And finally, if you're an educator, learn, promote, and teach Emacs. It offers so many applications that make a computer accessible to blind users (and sighted users over remote shells), so the more information out there to de-mystify its interface, the better!

    原文链接 https://opensource.com/life/16/6/emacspeak-brings-linux-blind]]>
    <![CDATA[ xah emacs tutorial on github?]]>Hick 叽喳:

         杀哥的 ergoemacs.org 很不错

    xah emacs tutorial on github?

    am thinking to put my emacs tutorial on github. That is, this entire website ergoemacs.org's content.

    2 things might happen.

    • ① nothing happens. Download/fork less that 1k.

    • ② Download/fork more that 1k.

    if nothing happens, then i might as well not do it.

    but why would i want people to download it? hard to say, but i guess it's basic human thing. I enjoy it when being helpful, it feels good to see results, and there's also the implicit thought that people will buy/pay for my tutorial more, or donate.

    Now, a separate question: “you have written a lot tutorials, many seems good, why isn't your tutorial popular?”

    I took a walk and asked myself about putting on github, and thus talked to myself for 20 minutes of logical analysis of the above and subsequented related questions, which prompted me to write it out now.

    First, note that my tutorial is somewhat popular but probably could've been far more popular. For example, many free tutorial stuff on github has tens of thousands or hundreds of thousands stars or forks. So, if i put mine out to github, why am i struggling for even 1k stars?

    I think the short answer is: i'm offensive.

    i don't give a fk to tradition, convention, organization, and i feel free to howl the most blunt criticisms sprinkled with four language thru-out. Oh, and i don't stick to English writing convention, nor programing conventions, because i think they are —if you disregard traditions, and dip into detail— stupid.

    and, for example, on reddit there's a section of tutorial links. I do not expect, nor will i ever ask, people to put mine there. I NEVER, do marketing. (well in recent years i've tried a bit, but it's like asking water to churn out fire.)

    since my life have faltered in late years, it feels uncomfortable to be myself, in my writings, as i've ask for donation, and many, many, have helped. There are few individuals i really like to thank, and there are quite many in total too. And, so, sorry if i sounded arrogant here for a moment.

    in the past 5 years, i've mellowed out. Partly because of getting old, i think. When you no longer have it, you don't brag about it anymore. e.g. Ali, Tyson, Madonna. Time moved on.

    also, coming out to beg money, was not a good thing. I'm sure, am now remembered by younger generation, as that programer who begged money to survive.

    ok, back to the upload to github question. In the above, we just explored the related question of popularity.

    Now, on the question of if put on github, will it get over 1k stars/download? It's hard to say. Possibly it might, or it might not.

    If i don't promote it, like, starting to say nice thing, positive things, think of ways to tweet stuff, create emacs puzzles, etc, things like that, and do nothing as much as i do now, i think it will not get over 1k stars on github. Probably just few hundred quiet downloads.

    ok, so far we've analyzed the situation. The 2 possible outcomes, the likely one, and why. But now, what about, what do i want?

    recently i feel like just putting it out on github and not caring about anything else, only the fact the whole's a easy download. (by the way, it has been that way, of a zip file, for few years in the beginning, 2008 or so. And there was not any ads. The ads are added 2013 or so.)

    PS this bit is addressing my readers, not talking to myself: Xah Lee's emacs tutorial, is best emacs tutorial out there, in depth, in breadth, in quality, in the ratio you can learn vs time for majority of people, as can be tested by scientific means, by far of any existing emacs tutorial out there, even all of them combined.

    I put out a vote, on twitter and Google Plus here:

    原文链接 http://ergoemacs.org/emacs/blog.html]]>
    <![CDATA[ Using Github Gists From Spacemacs]]>Github Gists are really useful when you want to share a piece of code or configuration without setting up a version control project. Rather than copy & paste into a Github Gists website, you can create a Gist from anySpacemacs buffer with a single command.

    All you need is to add the github layer to your ~/.spacemacs configuration file and reload your configuration M-m f e R or restart Spacemacs. Lets see just how easy it is to use Gists with Spacemacs.

    You can also use gist.el with your own Emacs configuration

    Connecting to your Github account

    When you first run any of the Gist or Github commands you will be prompted for your username, password and 2Factor code. The Gist.el code will create a personal access token on your Github account, avoiding the need to prompt for your Github login details each time.

    If you are prompted to enter your personal access token in Emacs, then visit your Github profile page and view thepersonal acccess tokenssection. Edit the token named git.el and regenerated the token. This will take you back to the personal access tokens page and display the new token for git.el. Copy this token into the [github] section of your ~/.gitconfig as follows

        user = jr0cket  
    oauth-token = thisishweretherealtokenshouldbepasted

    If git.el adds a password line to the [github] section of your ~/.gitconfig you should remove that password line. These Github actions only require your username and token.

    Creating a Gist from Spacemacs

    The current buffer can be copied into a Github Gist using the command M-x gist-buffer.

    Gist - create a Gist from the current bufferGist - create a Gist from the current buffer

    You can also create a gist just from a selected region of the buffer. First select the region using C-SPC and run the command M-x gist-region.

    If this is the first time using Github from Spacemacs, you will be prompted for your Github username & password. If you have already used Github from Spacemacs, then your account details will have been saved so you do not need to enter them each time.

    Keyboard shortcuts

    • M-m g g b : create a public gist from the current Spacemacs buffer

    • M-m g g B : create a private gist from the current Spacemacs buffer

    • M-m g g r : create a public gist from the highlighted region

    • M-m g g R : create a private gist from the highlighted region

    • M-m g g l : list all gists on your github account

    Replace M-m with SPC if you are using Spacemacs evil mode

    Updating a Gist

    When you create a Gist from a buffer there is no direct link between your buffer and the Gist. So if you make changes to your buffer you want to share, you can generate a new gist using M-x gist-buffer & delete the original one (see listing & managing gists below).

    Alternatively, once you have created a Gist, you can open that Gist in a buffer and make changes. When you save your changes in the Gist buffer, C-x C-s, the gist on gist.github.com is updated.

    Listing & managing Gists

    Use the command M-x gist-list or keybinding M-m g g l to show a list of your current Gists.

    Spacemacs - Gist listSpacemacs - Gist list

    In the buffer containing the list of your gists, you can use the following commands

    • RETURN : opens the gist in a new buffer

    • g : reload the gist list from server

    • e : edit the gist description, so you know what this gist is about

    • k : delete current gist

    • b : opens the gist in the current web browser

    • y : show current gist url & copies it into the clipboard

    • * : star gist (stars do not show in gist list, only when browsing them on github)

    • ^ : unstar gist

    • f : fork gist - create a copy of your gist on gist.github.com

    • + : add a file to the current gist, creating an additional snippet on the gist

    • - : remove a file from the current gist

    Creating Gists from files

    If you open a dired buffer you can make gists from marked files, m, by pressing @. This will make a public gist out of marked files (or if you use with a prefix, it will make private gists)

    Gist - create a gist from the marked files in diredGist - create a gist from the marked files in dired


    Its really easy to share code and configuration with Github Gists. Its even easier when you use Spacemacs) to create and manages gists for you. Have fun sharing your code & configurations with others via gists.

    Thank you.


    原文链接 http://jr0cket.co.uk/2016/03/Using-Github-Gists-from-Spacemacs.html]]>
    <![CDATA[ Emacs Right Click Context menu]]>This package is in development.

    A customizable context menu, call it from right-click of mouse. You can also use the context menu from keyboard.





    (depends-on "right-click-context" :git "git@github.com:zonuexe/right-click-context.git")


    Easy way (use minor-mode)

    (right-click-context-mode 1)

    ;; If want to use context menu by keyboard
    ;(define-key right-click-context-mode-map (kbd "C-c :") 'right-click-context-menu)

    Use keymap

    If you do not need the minor-mode, you can add a command to global keymap.

    (global-set-key (kbd "<mouse-3>") 'right-click-context-menu)

    (bind-key "C-c <mouse-3>" 'right-click-context-menu)
    (bind-key "C-c :" 'right-click-context-menu)

    Hide righter

    You will feel mode line is that it is complicated.

    ;; Use emoji
    (setq right-click-context-mode-lighter "??")

    ;; hidden
    (setq right-click-context-mode-lighter "")
    原文链接 https://github.com/zonuexe/right-click-context]]>
    <![CDATA[ Emacs Keyboard Design 28: Simple Seven]]>This makes sense. No Fn necessary. Emacs only.


    • Combining learning with layout results in a lot of changes

    • The Fn key

      • Great way to save a row

      • Emacs users are already comfortable with chords

      • Was interesting when smaller than tenkeyless; still good to get it down to 6 rows

    • Why are the F keys up so high?

      • Is the layout by design or arbitrary?

      • Can we make a rectangle with them flat?

    • Can a tenkeyless still be a rectangle?

      • The ANSI 104 layout is OK with resizing keys just to fit the shape

    • CAS

      • Easy to in this layout, redundant

      • C-M-s-H would be hard

    • The ANSI 104 layout

      • Is probably a good thing

      • I use it and like it

      • Make it a big rectangle

    • How to make the case

      • Easy to carry anywhere like a Dell keyboard

      • Easily 3d printable

      • Inexpensive

      • Open design

    • Can the system and navigation keys line up in a row on the right?

    • This keyboard is for Emacs users

      • That is the singular focus

      • Forget about general acceptance and use

        • It will be generally usable though

    • Steps

      • Move Escape row down above numbers and move them all left

      • Move Delete above backspace

        • Logical location

      • Ultra key

        • Via, better than omega

        • Control Meta Super Hyper

        • Move below Meta, shift needs to be outside enter, more familiar

        • Alt and Gui are better positioned, they are closer really

      • Align PrtSc with delete

      • Align cluster by frequency

        • Pg Up, Pg Dn

        • Home, End

        • Insert, PrtSc

      • Space bar can be 6 bars wide

        • Unsure where to find smaller

      • Main board keys on right (delete, super) can be smaller, make them all standardish

      • Keep right side keys flush with left

        • No, doesn’t look right

      • Modifier board

        • Fill to rectangle

        • Make Emacs modifiers bigger, 1.5w

        • Leave OS modifiers 1.25

      • Made control a homing here

        • There is a lot more space down there

        • Can make sense of lactation given two big bars and edges

        • Removed homing, unnecessary based on using a real heyboard

    原文链接 https://www.wisdomandwonder.com/article/10195/emacs-keyboard-design-28-simple-seven]]>
    <![CDATA[ Disable Mouse only inside Emacs]]>As laptop touchpads seem to be steadily increasing in size, one unfortunate consequence is that it becomes increasingly harder to avoid touching them by accident while you type. Most systems have safeguards in place that disable the touchpad as you’re typing, but they always seem to fall short for me when it comes to Emacs. While in Emacs, my hands are permanently resting on the keyboard (and over the touchpad), so even if I stop typing for several seconds I don’t want the touchpad to reactivate.

    There are ways to permanently deactivate the touchpad with a hotkey, but, so far, the solution that best fits my use-style is to disable it only inside Emacs.

    (define-minor-mode disable-mouse-mode
    "A minor-mode that disables all mouse keybinds."
    :global t
    :lighter " ??"
    :keymap (make-sparse-keymap))

    (dolist (type '(mouse down-mouse drag-mouse
    double-mouse triple-mouse))
    (dolist (prefix '("" C- M- S- M-S- C-M- C-S- C-M-S-))
    ;; Yes, I actually HAD to go up to 7 here.
    (dotimes (n 7)
    (let ((k (format "%s%s-%s" prefix type n)))
    (define-key disable-mouse-mode-map
    (vector (intern k)) #'ignore)))))

    All we do here is define a minor-mode that binds all mouse-related keys to ignore. This is a slight improvement over the code on this StackOverflow answer. Of course, let’s not forget to enable this.

    (disable-mouse-mode 1)

    Two relevant limitations:

    • This doesn’t distinguish between a touchpad an an actual mouse.

    • It is still possible for modes to define specific buttons that interact with the mouse, but that’s not a huge problem because these buttons take a small portion of the screen so it’s fairly difficult to touch them by accident.

    原文链接 http://endlessparentheses.com/disable-mouse-only-inside-emacs.html?source=rss]]>
    <![CDATA[ Show Magit Status window in fullscreen]]>When I moved back to my own Emacs configuration from Spacemacs one thing that I missed most was to have Magit’s status window cover the whole frame.

    Luckily this feature is easy to reproduce with a simple entry in [display-buffer-alist](http://www.lunaryorn.com/2015/04/29/the-power-of-display-buffer-alist.html):

    (add-to-list 'display-buffer-alist
    `(,(rx "*magit: ")
    (reusable-frames . nil)))

    Unfortunately there’s no built-in display function to show a window covering the whole frame but it’s easy enough to write one:

    (defun lunaryorn-display-buffer-fullframe (buffer alist)
    "Display BUFFER in fullscreen.

    ALIST is a `display-buffer' ALIST.

    Return the new window for BUFFER."
    (let ((window (display-buffer-pop-up-window buffer alist)))
    (when window
    (delete-other-windows window))

    We simply need to get hold of any arbitrary window for the buffer, and then just delete all other windows, leaving only the window for our buffer.

    That’s it. Enjoy and share :)

    原文链接 http://www.lunaryorn.com/2016/04/28/fullscreen-magit-status.html]]>
    <![CDATA[ fill-single-char-nobreak-p]]>Since Emacs 24 (or so), Polish-speaking users got a very nice gift: a function called fill-single-char-nobreak-p, which can be put into fill-nobreak-predicate. It prevents Emacs from breaking a line after a one-letter word when filling, which is a rule in Polish typography. Of course, when writing in LaTeX, it doesn’t matter at all, since then you use ties (tildes) to prevent breaks anyway (and there is an Emacs library called sierotki.el, which means “little orphans” in Polish, to insert those ties automatically). When writing emails (with hard line-breaks), however, this is a very useful thing.

    Unfortunately, one day I found that this function does not work correctly. When a one-letter word is preceded by an opening parenthesis, Emacs ceases to recognize it as such. And here’s why:

    (defun fill-single-char-nobreak-p ()
    "Return non-nil if a one-letter word is before point.
    This function is suitable for adding to the hook `fill-nobreak-predicate',
    to prevent the breaking of a line just after a one-letter word,
    which is an error according to some typographical conventions."
    (skip-chars-backward " \t")
    (backward-char 2)
    (looking-at "[[:space:]](*[[:alpha:]]")))

    As you can see, the function is not complicated. The fix, however, is not trivial. Of course, looking-backwould solve the problem, but it might be a tad too slow (as its docstring loyally warns).

    Quite interestingly, there is another function which serves the same purpose, though not in stock Emacs. It is called fill-single-letter-word-nobreak-p and is part of the aforementioned sierotki.elpackage. Here’s its source code, together with some comments:

    ;;; ----------------------------------------------------------------------
    ;;; The TeX Magic Space mode equivalent for filling (word wrap)

    ;;; see: http://www.emacswiki.org/cgi-bin/wiki/FillParagraph
    ;; It is simplified `fill-french-nobreak-p' from textmodes/fill.el.
    ;; The function `fill-french-nobreak-p' first appeared in textmodex/fill.el
    ;; rev. 1.132, and the single-letter detection code first appeared in
    ;; rev. 1.132, correct in 1.181. Not present in GNU Emacs 21.3
    (defun fill-single-letter-word-nobreak-p ()
    "Don't break a line after single letter word.
    This is used in `fill-nobreak-predicate' to prevent breaking lines just
    after a single letter word."
    (skip-chars-backward " \t")
    (unless (bolp)
    (backward-char 1)
    ;; Don't cut right after a single-letter word.
    (and (memq (preceding-char) '(?\t ?\ ))
    (eq (char-syntax (following-char)) ?w)))))

    (BTW, look up the source for fill-french-nobreak-p, including the docstring and the comment beneath it.) As you can see, it suffers from the same problem. (What’s maybe more interesting, the sierotki.elversion won’t fix a one-letter word which is already at the end of the line when filling with e.g. M-q, while the stock Emacs version will.)

    My proposal is as follows: it can be safely assumed that a string like a(i ? should not happen anyway, and so I’d add the opening paren (and maybe a bracket, just in case) to regex along the whitespace characters before a single letter.

    Again, the self-documenting nature of Emacs (and – of course – the fact that it’s open-source) show their strengths. Note that fixing this problem does not require Emacs recompilation – you just find the relevant function and correct it. (Also, saying C-h f fill-single TAB helps find the latter function I described; of course, I did have sierotki.el installed.)

    原文链接 http://mbork.pl/2016-04-26_fill-single-char-nobreak-p]]>
    <![CDATA[ Ivy 0.8.0 is out]]>Intro

    Ivy is a completion method that's similar to Ido, but with emphasis on simplicity and customizability.

    New package names

    Changes on MELPA

    Due to multiple requests, in an attempt to simplify things a new package ivy has been released on MELPA. The old package swiper, which used to provide most of the ivy features, now only provides swiper.el and depends on ivy. The third package counsel, which provides most of the goodies using ivy hasn't been changed and is still on MELPA. All three packages have the version 0.8.0currently.

    To reiterate the dependencies:

    • ivy depends on Emacs version larger than 24.1, preferably at least 24.3 (the most common one bundled currently with Linux distributions).

    • swiper depends on ivy and provides basically 3 commands: swiper, swiper-multi and swiper-all.

    • counsel depends on swiper and provides around 50 commands for all kinds of stuff. My favorites are counsel-M-x, counsel-git-grep, counsel-rhythmbox andcounsel-grep-or-swiper.

    Changes on GNU ELPA

    On GNU ELPA, a single package ivy-0.8.0 has replaced the previous stable version swiper-0.7.0. This package provides all the files combined of the three separate MELPA packages.

    Release summary

    The release consists of 282 commits over 5 months by 15 authors. The detailed Changelog is available here, thanks to the ever useful Org mode export. The raw Org file is in doc/Changelog.org in the main repository.

    The detailed documentation is available as an (ivy) Info node and also in HTML form here. If anyone wants to document something that's missing there, I'd appreciate the help: simply edit doc/ivy.org and send me a PR.

    Release highlights

    Below, I'll highlight some of the new features.

    Allow to compose collections

    For example, to stack the top 10 elements of recentf on top of counsel-locate, use this code:

    (defun small-test ()
    (cl-subseq recentf-list 0 10))


    Here, (original-source) represents the async candidates of counsel-locate. All extra sources are static - each function is called once to generate a list of strings, which will be filtered later.

    See #373 for more info.

    Improved documentation

    If you're not yet familiar with Ivy, you can get a quick reference card by pressing C-h m during any completion session. It will pop up an Org-mode buffer that describes most of the minibuffer key bindings.

    Additionally, C-o (hydra-ivy/body), which serves a quick reference as well, received a small restructuring and a new binding. Press D to go to the definition of this hydra. This is useful to see what each key does, you might even want to customize some of it.

    Completion in region

    From now on, ivy-mode will also set completion-in-region-function. This means that functions like:

    • C-M-i complete-symbol in many major modes,

    • TAB while in the M-: (eval-expression) minibuffer,

    • TAB in a shell buffer,

    will use ivy for completion.

    Many improvements to ivy-occur-mode

    You can "permanently" save any completion session by pressing C-c C-o (ivy-occur). This will generate a new buffer in ivy-occur-mode with all your current candidates inserted there. Clicking or pressing f on any of the candidates in that buffer will result in the appropriate action being called with that candidate.


    The *ivy-occur ...* buffers can actually be customized per collection type. Specifically for swiper, counsel-git-grep, counsel-grep and counsel-ag, the customizations are already in place that allow you to:

    • Edit the buffer with wgrep by pressing C-x C-q (ivy-wgrep-change-to-wgrep-mode).

    • Refresh the buffer due to the original files being changed by pressing g(ivy-occur-revert-buffer).

    The second feature is often useful to me when I want to somehow change a symbol throughout the project. First I make a list of all occurrences via e.g. swiperand ivy-occur. After I went through some of the occurrences, I can press g to refresh the search for the same symbol and see how many I still have left.

    Yet another cool feature is to press c (ivy-occur-toggle-calling) to toggle calling the action after each line movement and cycle through candidates by holding either j (ivy-occur-next-line) or k (ivy-occur-previous-line).

    ivy-set-action can work on all commands

    Here's the code I'm using currently in my config:

    (defun ivy-insert-action (x)
    (insert x)))

    '(("I" ivy-insert-action "insert")))

    This allows me to press M-o I to insert the current candidate into the buffer. For instance, if I want to quote an Emacs command, I can M-x (counsel-M-x), select the command I want and press M-o I to insert it instead of calling it.

    Virtual views in ivy-switch-buffer

    Here, "virtual" buffer means something that's close to a buffer but not an actual buffer. If you were using the setting ivy-use-virtual-buffers, you'd have your bookmarks and recentf items available to you as virtual buffers.

    The new feature allows to select a whole window configuration with many buffers inside nested horizontal and vertical splits from ivy-switch-buffer.

    To use it, set ivy-views, since it's nil by default. For instance, here's what I have in my config:

    (setq ivy-views
    '(("dutch + notes {}"
    (file "dutch.org")
    (buffer "notes")))
    ("ivy {}"
    (file "ivy.el")
    (buffer "*scratch*")))))

    For a more elaborate and detailed use, see this post by Manuel Uberti.

    Magic slash in file name completion

    From now on, if you want to enter a directory, simply select a candidate which is a directory and press /. You can still use the old binding C-j (ivy-alt-done), but/ is shorter and easier to get used to if you're switching from Ido.

    Note that this does not prevent the use of old functionality like:

    • // to enter the root directory,

    • /ssh: RET to connect via TRAMP.

    A better way to search with counsel-grep-or-swiper

    If you've ever been annoyed with the long start-up time of swiper in huge buffers, switch to this setting:

    (global-set-key "\C-s" 'counsel-grep-or-swiper)

    This command will use swiper for small buffers, and counsel-grep for large buffers.

    Something very similar to this command was highlighted in this post by Karl Voit.

    Just to give you an idea of how fast counsel-grep is:

    • It has 0s start-up time, since it's async.

    • For a two million line file weighing 50MB produced by copying org.el a few times, it takes 0.2s to find the 17,664 occurrences of the word hook. It still takes 7.5s to search for org in that file, simply because there are 500,000 candidates and it takes time for Emacs to simply receive that input.

    A list of all new commands

    The new commands since 0.7.0 are: counsel-tmm, counsel-imenu, counsel-decbinds,counsel-list-processes, ivy-switch-buffer-other-window, counsel-git-stash, counsel-git-log, counsel-pt, counsel-linux-app, counsel-ace-link, counsel-esh-history, counsel-shell-history, counsel-grep-or-swiper.

    If any of those sound interesting, go ahead and try them out.


    Thanks to all the contributors. Happy hacking!

    原文链接 http://oremacs.com/2016/04/26/ivy-0.8.0/]]>
    <![CDATA[ ANSI-colors in the compilation buffer output]]>Countless build tools and shell scripts use ANSI escape codes to colorize their output. This provides impressive improvements to readability when running from a terminal that supports them, but tends to cause a catastrophic mess anywhere else. Emacs’ compilation buffer is one such place. It doesn’t support ANSI colors by default, but that’s very easy to fix.

    Emacs already has a library for interpreting ANSI escape. All we need is to hook it onto compilation-mode.

    (require 'ansi-color)
    (defun endless/colorize-compilation ()
    "Colorize from `compilation-filter-start' to `point'."
    (let ((inhibit-read-only t))
    compilation-filter-start (point))))

    (add-hook 'compilation-filter-hook
    原文链接 http://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html?source=rss]]>
    <![CDATA[ Blogging with Orgmode]]>After several attempts of trying to get Orgmode working for my blog, I think I've finally settled on a workable solution using org-publish and a free static hosting service that works with Dropbox.


    I tried to keep the scope limited while moving to Orgmode, to keep things simple.

    1. Use Orgmode, duh!

    2. Publish the entire site as a single Orgmode project

    3. Use the auto-generated sitemap as the index (don't want to manually add links to new blog posts)

    4. Free static hosting with custom domain

    Setting up the project

    Here's my website's Orgmode project defintion defined in my Emacs config1:

     1: (setq org-publish-project-alist
    2: `(("website"
    3: :base-directory "~/Dropbox/Apps/updog/john2x/"
    4: :publishing-directory "~/Dropbox/Apps/updog/john2x/"
    5: :recursive t
    6: :exclude "level-.*\\|.*\.draft\.org"
    7: :publishing-function org-html-publish-to-html
    8: :auto-sitemap t
    9: :sitemap-filename "index.org"
    10: :sitemap-title "John Louis Del Rosario"
    11: :sitemap-sort-files "chronologically"
    12: :sitemap-function my-website-sitemap-function
    13: :html-link-up "/"
    14: :html-link-home "/"
    15: :html-preamble "<p class=\"date\">Published: %d</p>"
    16: :html-postamble "<p class=\"date\">Modified: %T</p>")))

    Let's go over the interesting properties:

    1. [:publishing-directory](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-publishing-directory): We use the same publishing directory since we want the generated html files to live alongside their source org files.

    2. [:recursive](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-recursive): Recursively export all org files within the :base-directory.

    3. [:exclude](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-exclude): Exclude some files from being exported and listed in the sitemap during publishing (e.g. drafts prefixed with .draft.org will not be published).

    4. [:auto-sitemap](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-auto-sitemap): Turn on automatic sitemap creation/updating when re-publishing the project.

    5. [:sitemap-filename](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-sitemap-filename): Name the generated sitemap as index.org so it gets published as index.html.

    6. [:sitemap-sort-files](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-sitemap-sort-files): Sort sitemap links based on the files' dates, useful for the blog posts.

    7. [:sitemap-function](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-sitemap-function): Use a custom function to generate the sitemap. We'll take a look at this shortly.

    8. [:html-(pre|post)amble](http://www.john2x.com/blog/blogging-with-orgmode.html#coderef-preamble): Use custom preamble. Although the docs say we could specify the pre/postamble as options (e.g. #+OPTIONS: html-preamble:"foo"), which would have been ideal, it doesn't seem to work with Orgmode 8.3.4. So we hardcode it at the project level.

    I wanted my index page to have all the links needed automatically added, which the sitemap function does nicely. But since the sitemap file is re-generated on every publish, I have to insert/remove any content from it via a custom sitemap generator function.

    (defun my-website-sitemap-function (project &optional sitemap-filename)
    "Custom sitemap generator that inserts additional options."
    (let ((buffer (org-publish-org-sitemap project sitemap-filename)))
    (with-current-buffer buffer
    (insert "\n#+OPTIONS: html-preamble:nil")
    (insert "\n#+SUBTITLE: a.k.a. john2x")
    (insert "\n\n#+BEGIN_EXAMPLE")
    (insert "\nCopyright (c) 2016 John Louis Del Rosario")
    (insert "\n#+END_EXAMPLE")

    It basically takes the output from the default sitemap function and adds/removes custom content.

    Setup files

    Orgmode allows documents to reference a SETUPFILE, which is basically an "included" template. This is useful for defining common header options across documents. For example:

    #+SETUPFILE: path/to/setup_file.org

    For this site, I have three setup files defined:

    1. A base template, org-templates/level-0.org

    2. A template specific for blog posts, org-templates/level-0-blog.org

    3. A template specific for one-off pages (e.g. the about page), org-templates/level-0-page.org

    The level-0 prefix was taken from Sebastian Rose's publishing tutorial2. It also makes excluding the templates easier.

    The blog post template includes the base template, and it enables the rendering of the table of contents.

    The page template includes the base template, and disables the preamble.


    Previous attempts

    Github Pages

    The previous version of this site was using Jekyll on Github Pages. I was hoping I could continue using Github Pages, but unfortunately there was no way to disable Jekyll processing. So my exported documents all came out incorrectly.

    Bitbucket static file hosting

    Next I looked into Bitbucket's undocumented feature to serve static content (similar to Github Pages, but without Jekyll). It works great, but they don't allow custom domains.

    What's up dog?

    I finally stumbled on updog.co, a free service that serves files directly from your Dropbox folder. It also allows custom domains for each site. Since I already have a Dropbox account, I didn't have to shell out any cash. And if/when the service goes down, the owner is cool enough to provide the source3, so if I can't find an alternative, I'd just bite the bullet and probably run my own instance of the service.


    So now that I have everything set up, writing a new post is a great experience. I get to write using Org, which makes writing more enjoyable. For drafts that aren't ready for publishing yet (but which I'd like to view a render of), I just need to name them *.draft.org and they won't be listed in the sitemap.

    Once everything is ready, a simple C-c C-e P p publishes everything and Dropbox + updog.co does the rest!


    There's still some rough edges I'd like to iron out.

    1. The index/sitemap is very bare bones. I'll probably write an improved sitemap function in the future.

    2. I'm still trying to figure out how to generate an RSS feed.

    3. I'd like to render the KEYWORDS option in a post (since Google ignores the keywords meta tag).

    4. My favicon doesn't seem to be loaded. I wanted to use the Orgmode unicorn.

    5. The style is pretty much non-existent at the moment. Mostly due to laziness, but I kind of like the aesthetic of it (especially if using the Computer Modern font4).

    Copyright (c) 2016 John Louis Del Rosario



    View my Emacs config in full here http://www.john2x.com/emacs.html







    原文链接 http://www.john2x.com/blog/blogging-with-orgmode.html]]>
    <![CDATA[ 2016-04-25 Emacs News]]>
  • Navigation:

  • Org Mode:

  • Coding:

  • Emacs development:

  • Other:

  • New packages:

    • arview: extract and view archives in the temporary directory

    • docker-api: Emacs interface to the Docker API

    • ego: a static site generator based on org mode, forked from org-page.

    • embrace: Add/Change/Delete pairs based on `expand-region’

    • emms-status: Display track description and playing time in the mode line

    • erc-twitch: Support for Twitch emotes for ERC.

    • fifo-class: First in first out abstract class

    • flymake-solidity: A flymake handler for solidity using solc

    • helm-systemd: helm’s systemd interface

    • imapfilter: run the imapfilter executable

    • ivy-bibtex: A BibTeX bibliography manager based on Ivy

    • pathify: Symlink your scripts into a PATH directory

    • sendto: send the region content to a function

    • shift-number: Increase/decrease the number at point

    • signal: Advanced hook

    • xref-js2: Jump to references/definitions using ag & js2-mode’s AST

  • 原文链接 http://sachachua.com/blog/2016/04/2016-04-25-emacs-news/]]>
    <![CDATA[ selected.el - Keymap for when region is active]]>Hick 叽喳:

        也没用, 只看大概看了下介绍, 甚至因为时间因素暂时没去认真理解和试用, 这种选择一块以后相应的按键就有特定的功能这种思路感觉挺聪明的, 乃至可以叫个名字 交互式编辑器? 

    selected.el provides the selected-minor-mode for Emacs. When selected-minor-mode is active, the keybindings inselected-keymap will be enabled when the region is active. This is useful for commands that operates on the region, which you only want bound to a key when the region is active.

    selected-keymap has no default bindings. Bind it yourself:

    (require 'selected)
    (define-key selected-keymap (kbd "q") #'selected-off)
    (define-key selected-keymap (kbd "u") #'upcase-region)
    (define-key selected-keymap (kbd "d") #'downcase-region)
    (define-key selected-keymap (kbd "w") #'count-words-region)
    (define-key selected-keymap (kbd "m") #'apply-macro-to-region-lines)

    It is cleaner with use-package:

    (use-package selected
    :commands selected-minor-mode
    :bind (:map selected-keymap
    ("q" . selected-off)
    ("u" . upcase-region)
    ("d" . downcase-region)
    ("w" . count-words-region)
    ("m" . apply-macro-to-region-lines)))

    Then activate it with M-x selected-minor-mode. It can be a good idea to add selected-minor-mode to the hooks of the major-modes where you want it activated. selected-off is a function which deactivates the keybindings until the next time the region becomes active. This is useful when you want to execute a command on the region, but then disable selected-minor-mode in favour of other commands like multiple-cursors.

    Major mode specific bindings

    You may want some keybindings to operate on the region, but only if you’re in a certain major-mode. This is possible if you create a keymap named selected-<major-mode>-map (for instance selected-org-mode-map) and add the mode-specific bindings there. Here’s an example, using use-package:

    (use-package selected
    :commands selected-minor-mode
    (setq selected-org-mode-map (make-sparse-keymap))
    :bind (:map selected-keymap
    ("q" . selected-off)
    ("u" . upcase-region)
    ("d" . upcase-region)
    ("w" . count-words-region)
    ("m" . apply-macro-to-region-lines)
    :map selected-org-mode-map
    ("t" . org-table-convert-region)))

    Recommended resources

    Here’s some functions and packages that are useful with selected.el:

    Feel free to suggest additions to this list!

    原文链接 https://github.com/Kungsgeten/selected.el]]>