Emacs Tramp SSH Hostname Completion

I store ssh configurations in separate files with categories. Forexample personal servers and work related servers are stored different files. Include directive is used to define external files in ~/.ssh/config. A configuration like below is very useful.

# ~/.ssh/ssh_config_company1
Host top-secret-prod-host
  Hostname prod.example.com
  User root
  
# ~/.ssh/ssh_config_company2
Host top-secret-dev-host
  Hostname dev.example.com
  User root

# ~/.ssh/config
Include ssh_config_company1
Include ssh_config_company2

But with default configuration, emacs tramp hostname auto completion is not working. When I use full name of the host, it connects to machine successfuly. But when try to complete hostname with TAB, it is not working. After a little research, I lost my all hopes to fix the problem. But I saw a configuration on a unrelated stackoverflow post. When I try, it fixed the my problem.

(tramp-set-completion-function
 "ssh"
 '((tramp-parse-sconfig "/etc/ssh_config")
   (tramp-parse-sconfig "~/.ssh/config")))

It could be useful when similar problems.


Increase Version Number With Maven

If you have a maven project and want to change version number automatically, there is buil-helper maven plugin to do this. Let’s assume that we have a pom.xml like below.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0.0</version>

  <name>my-app</name>
</project>

We can update version number from 1.0.0 to 1.0.5 with the command below.

mvn versions:set -DnewVersion=1.0.5 versions:commit

Or we can use this command increase version number automatically.

mvn build-helper:parse-version versions:set \
    -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} \
    versions:commit

Now version number is 1.0.6

To increase minor version number

mvn build-helper:parse-version \
    versions:set \
    -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.buildNumber} \
    versions:commit

To increase major version number

mvn build-helper:parse-version versions:set \
    -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0 \
    versions:commit

You can visit Build Helper Maven Plugin’s page for more detailed information.