Tag Archives: Programming

MKVToolNix v3.4.0 released

I’ve released MKVToolNix v3.4.0. This release contains several important bug fixes and a few new features. Two new translations (Russian and Ukrainian) have been added.

There are two changes for package maintainers: 1. the two new translations I’ve mentioned and 2. MKVToolNix requires the new releases of libebml v0.8.0 and libmatroska v0.9.0.

Here are the usual links to the home page, to the source code, to the Windows installer and the 7zip archive.

All binaries that I provide myself have already been uploaded.

Please see the full ChangeLog for a list of changes since the previous release, v3.3.0.

libebml v0.8.0 and libmatroska v0.9.0 released

The Matroska team has released libebml v0.8.0 and libmatroska v0.9.0. These releases mostly add new macros and API entries to make a smooth transition to libebml2 & libmatroska2 that are coded in C (with a C++ legacy layer). It also fixes a memory freeing bug that was triggered in VLC. The next MKVToolNix release will require the new versions of both libraries.

Nothing should have changed from a package maintainer’s point of view.

Binary packages for Debian, Ubuntu, Fedora Core and OpenSuSE are available at the MKVToolNix downloads page.

Switching identifier naming style between Camel Case and C style in Emacs

There are several naming styles for identifiers used in programming. Some use-dashes-between-words (e.g. Lisp), others MashWordsTogetherAndCapitalizeThem (most often called Camel Case), and a third one puts_underscores_between_characters_and_converts_everything_to_lower_case (sometimes called “C style”).

Often I have to convert code from one naming convention to another. When I have to do that this usually happens with languages that often use both styles, e.g. C/C++ or even PHP and Ruby. For those cases I’ve written an Emacs Lisp function that can convert the identifier at point from C style naming to Camel Case style and back. It detects the current style by looking for an underscore. Here’s the code:

(defun mo-toggle-identifier-naming-style ()
  "Toggles the symbol at point between C-style naming,
e.g. `hello_world_string', and camel case,
e.g. `HelloWorldString'."
  (interactive)
  (let* ((symbol-pos (bounds-of-thing-at-point 'symbol))
         case-fold-search symbol-at-point cstyle regexp func)
    (unless symbol-pos
      (error "No symbol at point"))
    (save-excursion
      (narrow-to-region (car symbol-pos) (cdr symbol-pos))
      (setq cstyle (string-match-p "_" (buffer-string))
            regexp (if cstyle "\\(?:\\_<\\|_\\)\\(\\w\\)" "\\([A-Z]\\)")
            func (if cstyle
                     'capitalize
                   (lambda (s)
                     (concat (if (= (match-beginning 1)
                                    (car symbol-pos))
                                 ""
                               "_")
                             (downcase s)))))
      (goto-char (point-min))
      (while (re-search-forward regexp nil t)
        (replace-match (funcall func (match-string 1))
                       t nil))
      (widen))))

The code was inspired by a question on StackOverflow about this topic.